[Project] Third Person Shooter

xxxtrickyxxx

(o Y o)
Reaction score
64
Well, depends what you consider a proper shooter. Single player sure it will do about anything you want it to if you know the right ways to go about doing it. Multiplayer however, most shooters these days require client prediction so you wont have the lag effect we are experiencing in both wc3 and sc2. All games do exactly what sc2 is doing but because of the client prediction you don't notice it on your computer but if you sat two computers side by side online watching each other move around you would see the delay.

Periodics themselves aren't a bad thing, theres nothing wrong with using them. I simply meant I did not like moving my unit around and adjusting camera using a loose periodic that wasn't perfectly in sync with the key firing. It doesn't really matter much i guess but im obsessive compulsive like that. You should just use 0.00 instead of 0.03, it might be a little faster im not sure. Seems if you type anything other than leaving it at zero, it automatically adjusts to .06. im not sure what your doing with your camera, because its just mine runs so much smoother theres no jerkiness at all.

Sure theoretical bullets work! They worked perfectly in my wc3 map, and they will work even better in sc2! What wont work? You can't go wrong with an instantly calculated formula. just need to make sure you have variables predefined so it knows the sizes of your unit etc.
 

onisagi

New Member
Reaction score
6
if anything it'll work more efficiently...

his camera lags like that because hes using a camera action that is unblendable to offset the camera to over-the-shoulder view. Right now there doesn't seem to be a good way to offset your camera without that jittery effect, i was thinking you could create an invisible unit following the side of your unit and use camera follow on your invisible unit. Basically, force your camera to use a function that is smoother and still be able to offset to the side.

i think wut tricky was suggesting was similar to your old grenades, where you calculated trajectory and where it lands. Basically calculate if you hit a target on all targets within a vacinity. (aka Instant-hit shooting)

Tricky: how do you plan to decide which units get calculated for collision and which don't? doing calculations for things in a vacinity sounds pretty bad wen yu have a ton of units close together...

There are plenty of ways to make it so you run zero periodic actions until you need them to run. The problem seems to come from many things... not just input lag, and not just periodic actions. Using projectiles only for stuff like grenades should be okay, it doesnt happen often and only happens when you throw a grenade. The actual shooting should really stop using projectiles, and especially not with physics. Because of the sheer number of iterations and actions per bullet that needs to be done in a very small time frame by even just 1 player will be too much to handle. There's latency to any and every single action you do, and it adds up really quick. Not to mention you're rapid firing those bullets like no tomorrow... xD

I think instant firing is perfectly fine... just add in an effect that makes it look like you're firing projectiles... xD the impact effects can still be on the spot of collision.

If you're really bent on projectiles, i've seen people use issue order on bullet units to move to where ever you're aiming, where it dies at the end of its movement or when it hits a target. This can help to remove instant-moves in the x-y plane, and only change height. Issuing a single move order every fired shot shouldn't be too intensive. The game is made to handle a large number of issue order commands.

i wonder if it'll help to make an action definition for the keypress input and have it run on its own thread? There's some options inside action def's to make it run on a separate threads.

I say... write up and test other alternative forms of shooting and collision before retail, and incorporate a way to switch between the different shooting styles. Then wen retail comes you can test and choose which one you wanna go with.

I think you dont even need periodic events to update movement... you can just put that stuff inside your keypress actions, and have it repeat action until you keyup. Havent tested/tried that yet, but sounds like it'll work.
 

wingdnosring

New Member
Reaction score
16
I never move bullets instantly. All of my bullets move via the Issue Order command and a custom mover. The 0.03 periodic trigger tells them how far to move every 0.03 seconds and detects collision.

Move unit instantly doesn't work properly with units that ignore terrain height :S.

But yeah, I was considering making it just one move order instead of a new one every 0.03 seconds. The only downside is that I'll have to take bullet speed out entirely and simply have users adjust their bullet speed in the data editor, which seems a shame since right now everything aside from appearance is done purely through one line of triggering.

I've always been against theoretical bullets. I find it detracts from gameplay to me. I much prefer actually aiming to compensate for bullet speed. Besides, what if I don't want all my weapons to have instant speeds? Maybe I want a rocket launcher to lob bullets much slower, so it can be powerful, but dodgeable. Theoretical bullets sort of blow that. Besides, theoretical bullets still require just as much code and I'm pretty sure they actually take up more of a computer's CPU, since the massive wall of code for collision detection runs even more frequently than 0.03 seconds. I could be wrong, I don't pretend to know better than anybody else, but it certainly seems that way to me. And if you're moving an effect anyway, won't the code literally be the same, just in different locations?

As for the camera. The stuttering you see on my camera is caused (as Onisagi said) by panning every 0.03 seconds. Panning temporarily freezes other camera input, while following a unit does not. I tried placing an invisible unit beside the marine and following that instead, but it seemed to lag behind the player. It only actually followed the unit if it got a certain distance away from the current camera point.

I'm all for more ideas on how to improve this stuff, but theoretical bullets don't agree with me. As for the camera...if you guys can find something that really works well, I'll import it immediately (or at least try it out). At the moment, I'm really not sure what to work on. I know of a fairly large collection of bugs that I could start sorting out, but I feel rather stymied at the moment since I hit that bullet height snag so quickly (which still hasn't been resolved by the way).

It seems like we'll never get proper solutions to some of these issues until tests can be carried out on the retail games' servers. If worse comes to worst, I could always settle for a single player campaign...:p

[Edit]: I just went into my library and changed stuff around to make bullet movement all one order. The 0.03 is purely collision detection now.
 

Arkless

New Member
Reaction score
31
If you're a speedfreak (not ment offensive) you could give every bullet a behaviour wich checks if there are units in range. Should be faster then the trigger editor.
To check if everything is right you could run a DMG effect (for example) and have a unit takes damage "from <source> effect" react to that. I dunno if that triggers on 0 dmg but you could heal 1 hp in case you need 1 dmg.

Sorry if that was suggested somewhere before and I missed it.
 

onisagi

New Member
Reaction score
6
wut arkless suggests is not unlike having a single unit order command, and have behaviors on your unit that detects and causes damage to a unit that comes close enough. Basically, what i was suggest in my previous post, but i added you should still adjust height for bullets that dont defy gravity.

Or... You should be able to create parabolic height changing as well as bullet effects within data module and without triggers.

A baneling bullet, with a lowered aggro/attack radius should work pretty lag free. It also opens doors to weapons that can perform homing style targeting, by changing attack radius.

You don't necessarily have to only use one form of shooting... your grenade launchers could be using a special algorithm gears towards physics heavy weapons, and for general weapons like pistols and rifles that have bullet speeds that are normally not visible anyways you can use instant-hit. But i can understand if yu wanna keep your system from being to complicated, and using a universal method.

Btw, wingd the flying height thing i was suggesting... have you tried it yet? It's the same parameter that decides how high a pheonix/medivac or wutever flies in the air, as opposed to looking like its sitting on the ground. I'm pretty sure it'll fix yur bullet height problem. I'm just short of testing it myself...

i believe at 0 value the field makes your unit halfway inside the floor. It decides how high the middle point of your unit model is with respect to the terrain floor, and is apart from flying height that you see inside triggers. I'm quite sure offsetting your bullets off the floor at 0.4 using this field will make them appear at 0.4 height wen yu create them at a point, and if you're on higher terrain, you just have to add terrain ground/flying height to the bullet's height upon creation before you check for collision. You'll probly only need to do this if your bullet is ignoring terrain and not being created at the correct height relative to your shooting unit. Please give this a try...
 

wingdnosring

New Member
Reaction score
16
I'm not sure what field you're referring to. If you mean UI - Height, I've messed around with that quite a bit already. Setting it to a number beneath the ground height wherever it's standing causes it to get stuck in the floor, as you said. Setting it above the ground height (say...10 or so), causes it to be in the air. The problem is that my bullets are already set to height 0.

So I have no idea why they're being created so high in the air. They should be starting in the ground, as you suggested. I'm wondering if using a two dimensional point with an ignore terrain height unit somehow always sets a Z value of the skybox or something...but that can't be it either, because I've tried using x, y, z points in bullet creation before...

Please specify the field. If it's UI - Height, then I've already tried it. If it's something else I will try it immediately.

As for the suggestion of Behaviors, I have considered that many times. In fact, I actually ran a test on it once, but what I decided was that it required too much time to create each new weapon. The amount of work in the data editor seemed to become bigger and bigger, until I finally just decided one action in the trigger editor made more sense. I want my system to be as customizable as possible with little work from the end user. I want other people to use this as well, so simplicity in creation is the key. That's also a big reason why I went away from theoretical bullets.

I will continue adding new methods as I go. I don't mind creating twenty different methods of shooting if that's what people want, I just want to make sure its accessible. For the moment, grenades have one shooting system in place (thanks to onisagi), which I may also incorporate into bullets that are lobbed in a similar fashion. For all other weaponry, I think my current system can get the job done (for now). I keep making little changes that don't take much time, but make a world of difference. The Impale Effects option when creating weapons is a good example of this.
 

onisagi

New Member
Reaction score
6
impale aka impact effect?

So, did yu get grenades to shoot correctly without being effected by terrain yet? Cuz v6 didn't have that yet.

Yeah yur bullet starting height thing is very odd... i wouldn't be able to figure it out unless i took apart your triggers, but so time consuming to do so... mebbe yu should just take this chance to do some commenting for your system, cuz you're gonna need it eventually anyways. It'll also help others to diagnose problems easier.

I could only imagine a couple reasons why it would behave the way it does... one major one... its possible you left in code that was meant to elevate the bullet by terrain height, and it wasnt necessary to do so for that particular bullet(s). Or maybe it has to do with the mover or reference plane of your unit... If you're doing calculations using ground height and your unit is actually referencing flying heights only, something weird might occur? or vice-versa? throwing out some possibilities, in case you havent considered.
 

wingdnosring

New Member
Reaction score
16
impale aka impact effect?

Nope, Impale is seperate from Impact. You'll notice one of the parameters in my Create Weapon action is a boolean. That's for Impale Effects. Basically if it's set to true, your bullet continue through enemies. So if you have ten enemies standing in a line and shoot, you'll hit all ten.

So, did yu get grenades to shoot correctly without being effected by terrain yet? Cuz v6 didn't have that yet.

I thought Version six had grenades working properly :O. I'll double check it. [Edit]: Yeah, the grenades seem to be working fine. What in particular seemed incorrect?

Yeah yur bullet starting height thing is very odd... i wouldn't be able to figure it out unless i took apart your triggers, but so time consuming to do so... mebbe yu should just take this chance to do some commenting for your system, cuz you're gonna need it eventually anyways. It'll also help others to diagnose problems easier.

I'll start commenting now. How extensive do you think the comments need to be? It's hard to tell what's required when you understand the code so well, know what I mean?

[Edit]: I commented some of the most crucial triggers to the system, but I'm not sure what sort of information you want out of them. Here's an example of the Bullet Collision trigger (formerly the Bullet Travel trigger)

Code:
Bullet Collision
    Events
        Timer - Every 0.06 seconds of Game Time
    Local Variables
        ImpactEffectsLoop = 0 <Integer>
        BulletSpeedLoop = 0 <Integer>
        TemporaryBulletRemovalGroup = (Empty unit group) <Unit Group>
        TemporaryBulletGroupLoop = 0 <Integer>
        HeightComparisonForTarget = 0.0 <Real>
        TemporaryBulletGroupBull = (Empty unit group) <Unit Group>
        CurrentBulletLocation = No Point <Point>
        FutureBulletLocation = No Point <Point>
        Impact Location = No Point <Point>
        ConfirmedTargetBull = No Unit <Unit>
        BulletTravelLoop = 0 <Integer>
        ClearActorLoop = 0 <Integer>
    Conditions
    Actions
        ------- This Trigger Detects Bullet Collision
        General - For each integer BulletTravelLoop from 1 to 14 with increment 1, do (Actions)
            Actions
                ------- BulletGroups are unit groups that contain all bullets that are currently on the move
                Unit Group - Pick each unit in BulletGroups[BulletTravelLoop] and do (Actions)
                    Actions
                        Variable - Set FutureBulletLocation = (Position of (Picked unit))
                        ------- Group potential targets
                        Variable - Set TemporaryBulletGroupBull = (Units in (Region(FutureBulletLocation, 2.0)) having alliance Enemy with player (Owner of (Picked unit)) matching Excluded: Missile, Dead, Hidden, Invulnerable, with at most Any Amount)
                        ------- Add potential cover to target group
                        Unit Group - Add all units in (Any units in (Region(FutureBulletLocation, 2.0)) owned by player Any Player matching Required: Destructible, with at most Any Amount) to TemporaryBulletGroupBull
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                (Number of Any units in TemporaryBulletGroupBull) >= 1
                            Then
                                ------- Sets the unit's height to its supply cost/10.  If the unit is behind cover, that value is halved
                                General - For each integer TemporaryBulletGroupLoop from 1 to (Number of Any units in TemporaryBulletGroupBull) with increment 1, do (Actions)
                                    Actions
                                        General - If (Conditions) then do (Actions) else do (Actions)
                                            If
                                                ((Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull) has NullCoverHidingBuff) == true
                                            Then
                                                Variable - Set HeightComparisonForTarget = (((Unit type of (Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull)) Supplies Used) / 20.0)
                                            Else
                                                Variable - Set HeightComparisonForTarget = (((Unit type of (Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull)) Supplies Used) / 10.0)
                                        General - If (Conditions) then do (Actions) else do (Actions)
                                            If
                                                ------- If any of the below conditions are true, the unit is removed from the potential target group
                                                Or
                                                    Conditions
                                                        (Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull) == No Unit
                                                        (Distance between FutureBulletLocation and (Position of (Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull))) > (((Unit type of (Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull)) Radius) * 2.0)
                                                        (Abs((((Height of (Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull)) + (Ground height at (Position of (Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull)))) - (Height of (Picked unit))))) > HeightComparisonForTarget
                                                        ((Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull) is Dead) == true
                                            Then
                                                Unit Group - Add (Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull) to TemporaryBulletRemovalGroup
                                            Else
                                Unit Group - Remove all units in TemporaryBulletRemovalGroup from TemporaryBulletGroupBull
                                Unit Group - Remove all units from TemporaryBulletRemovalGroup
                                ------- Second Check
                                General - If (Conditions) then do (Actions) else do (Actions)
                                    If
                                        (Number of Any units in TemporaryBulletGroupBull) >= 1
                                    Then
                                        ------- Detects the angle between the bullet and the target.  Since bullets move so quickly, units behind the bullet must be given priority
                                        General - For each integer TemporaryBulletGroupLoop from 1 to (Number of Living units in TemporaryBulletGroupBull) with increment 1, do (Actions)
                                            Actions
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        Or
                                                            Conditions
                                                                (Abs(((Facing of (Picked unit)) - (Angle from FutureBulletLocation to (Position of (Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull)))))) >= 90.0
                                                                (Abs(((Facing of (Picked unit)) - (Angle from FutureBulletLocation to (Position of (Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull)))))) <= 270.0
                                                    Then
                                                        Unit Group - Add (Unit TemporaryBulletGroupLoop from TemporaryBulletGroupBull) to TemporaryBulletRemovalGroup
                                                    Else
                                        ------- Confirms unit collision and sets the target unit to a variable.  Units behind the bullet are given priority over units in front
                                        General - If (Conditions) then do (Actions) else do (Actions)
                                            If
                                                (Number of Any units in TemporaryBulletRemovalGroup) >= 1
                                            Then
                                                Variable - Set ConfirmedTargetBull = (Closest unit to FutureBulletLocation in TemporaryBulletRemovalGroup)
                                            Else
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        (Number of Any units in (Any units in TemporaryBulletGroupBull owned by player Any Player matching Required: Destructible, with at most Any Amount)) >= 1
                                                    Then
                                                        Variable - Set ConfirmedTargetBull = (Closest unit to FutureBulletLocation in (Any units in TemporaryBulletGroupBull owned by player Any Player matching Required: Destructible, with at most Any Amount))
                                                    Else
                                                        Variable - Set ConfirmedTargetBull = (Closest unit to FutureBulletLocation in (Any units in TemporaryBulletGroupBull owned by player Any Player matching Excluded: Destructible, with at most Any Amount))
                                        ------- If the weapon is not able to Impale targets, the bullet is removed from this collision check group
                                        General - If (Conditions) then do (Actions) else do (Actions)
                                            If
                                                ImpaleBoolean[CurrentWeapon[(Owner of (Picked unit))]] == false
                                            Then
                                                Unit Group - Remove (Picked unit) from BulletGroups[BulletTravelLoop]
                                            Else
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        ((Unit type of ConfirmedTargetBull) is Destructible) == false
                                                    Then
                                                    Else
                                                        Unit Group - Remove (Picked unit) from BulletGroups[BulletTravelLoop]
                                        General - If (Conditions) then do (Actions) else do (Actions)
                                            If
                                                ((Unit type of ConfirmedTargetBull) is Destructible) == false
                                            Then
                                                ------- Sets the position of impact for effects to be added
                                                Variable - Set CurrentBulletLocation = (Position of ConfirmedTargetBull)
                                                Variable - Set FutureBulletLocation = ((CurrentBulletLocation offset by ((Unit type of ConfirmedTargetBull) Radius) towards (Angle from CurrentBulletLocation to (Position of (Picked unit))) degrees) offset by ((Height of (Picked unit)) - (Ground height at FutureBulletLocation)) height)
                                            Else
                                        ------- Runs through all weaponry (to a maximum of 50) to detect which weapon is being used
                                        General - For each integer ImpactEffectsLoop from 1 to 50 with increment 1, do (Actions)
                                            Actions
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        (Unit type of (Picked unit)) == WeaponBulletType[ImpactEffectsLoop]
                                                    Then
                                                        ------- Adds damage effect to the target.  If the weapon is the Blast Pistol, a Behavior is added instead
                                                        General - If (Conditions) then do (Actions) else do (Actions)
                                                            If
                                                                (Unit type of (Picked unit)) == WeaponBulletType[6]
                                                            Then
                                                                Unit - Add 1 Blast Pistol Target to ConfirmedTargetBull from (Picked unit)
                                                            Else
                                                                Environment - Create WeaponImpactEffect[ImpactEffectsLoop] on ConfirmedTargetBull from (Picked unit)
                                                        ------- Creates the Impact Effect at our designated point.  If a unit has shields or is not organic, its ground impact effect is played
                                                        General - If (Conditions) then do (Actions) else do (Actions)
                                                            If
                                                                ((Unit type of ConfirmedTargetBull) has Biological attribute) == true
                                                                (ConfirmedTargetBull Shields (Current)) == 0.0
                                                            Then
                                                                Actor - Create actor ImpactActorDirectHit[ImpactEffectsLoop] at point FutureBulletLocation
                                                            Else
                                                                Actor - Create actor ImpactActorShield[ImpactEffectsLoop] at point FutureBulletLocation
                                                    Else
                                        ------- Impact Actor variables are used to keep track of recently created Impact Actors so they can be destroyed later
                                        Variable - Set ImpactActorNumber = (ImpactActorNumber + 1)
                                        Variable - Set ImpactActors[ImpactActorNumber] = (Last created actor)
                                        ------- If the weapon is not able to Impale targets, the bullet is removed from the game
                                        General - If (Conditions) then do (Actions) else do (Actions)
                                            If
                                                ImpaleBoolean[CurrentWeapon[(Owner of (Picked unit))]] == false
                                            Then
                                                Unit - Remove (Picked unit) from the game
                                            Else
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        ((Unit type of ConfirmedTargetBull) is Destructible) == false
                                                    Then
                                                    Else
                                                        Unit - Remove (Picked unit) from the game
                                    Else
                            Else
                                ------- These Else actions run if the bullet reaches the ground or comes into contact with a cliff
                                General - If (Conditions) then do (Actions) else do (Actions)
                                    If
                                        (Height of (Picked unit)) < (Ground height at FutureBulletLocation)
                                    Then
                                        Variable - Set Impact Location = (FutureBulletLocation offset by (Height of (Picked unit)) height)
                                        General - For each integer ImpactEffectsLoop from 1 to 50 with increment 1, do (Actions)
                                            Actions
                                                General - If (Conditions) then do (Actions) else do (Actions)
                                                    If
                                                        (Unit type of (Picked unit)) == WeaponBulletType[ImpactEffectsLoop]
                                                    Then
                                                        Actor - Create actor ImpactActorShield[ImpactEffectsLoop] at point FutureBulletLocation
                                                    Else
                                        Variable - Set ImpactActorNumber = (ImpactActorNumber + 1)
                                        Variable - Set ImpactActors[ImpactActorNumber] = (Last created actor)
                                        Unit - Remove (Picked unit) from the game
                                    Else
                ------- Destroys all recent Impact Actors if they exceed a certain limit
                General - If (Conditions) then do (Actions) else do (Actions)
                    If
                        ImpactActorNumber >= 990
                    Then
                        General - For each integer ClearActorLoop from 1 to ImpactActorNumber with increment 1, do (Actions)
                            Actions
                                Actor - Kill actor model ImpactActors[ClearActorLoop]
                                Actor - Kill actor scope (Actor scope for ImpactActors[ClearActorLoop])
                        Variable - Set ImpactActorNumber = 1
                    Else
 

onisagi

New Member
Reaction score
6
I think for commenting, anything is better than nothing. What you did so far will already help alot.

Your grenades seem to travel weird at certain points, like it jumped up all of a sudden and came back down and continued traveling as normal. At first i thot it was becuz of terrain difference, but it happens on flat land too. Do you notice that?
 

xxxtrickyxxx

(o Y o)
Reaction score
64
You might want to at least take a look at my camera library for movement. I will probably change some stuff and add some extra functions to make things simpler but thats pretty much my WASD movement there. Its very similar to Jesus's since he did a pretty good job doing it with triggers in a lib but mines somewhat different. Not saying you should use it, but maybe it will help you if you want to change your camera stuff eventually. I didn't comment it however so it may not be of any use just look how its constructed.
 

wingdnosring

New Member
Reaction score
16
I looked at it. Very nice. I didn't even realize how jerky my camera was until I saw yours. There are two major differences I noticed:

1. Your camera is zoomed out more and follows the unit rather than panning. This prevents the issues you see with my system, where occassionally the camera has to relocate because it is inside the controlled unit.

2. Your camera is especially smooth when going up/down ramps. Panning like I do leads to really awkward camera angles on ramps, which is most unfortunate.

Ideally, I'd like the offset to work though. Without the offset, you can't see in front of the character (unless you zoom out a fair bit, like you have). I much prefer a closer proximity to the controlled unit.

Another advantage to doing things your way has just occurred to me. My way, the camera may become slightly desynced with the controlled unit, whereas yours guarantees a constant lock.

How did you change the game camera to follow properly though? When I tried to do that it lagged behind the player like you wouldn't believe. If I can duplicate your camera properties, I may be able to just follow a hidden unit, like I tried before.

[Edit]: Found your custom camera changes. I think the velocity is what screwed me. I'm going to try implementing it and see how it goes.

[Edit 2]: I tried implementing your camera, but it's still jerky as hell. It doesn't follow the unit properly, it lags behind a fair bit. How do I change that? I copied your camera exactly except for the 'Zoom Levels' field.
 

xxxtrickyxxx

(o Y o)
Reaction score
64
hm, are u not using the follow camera though? im not sure editing the actual camera in the data editor will do much if you are still panning?
 

xxxtrickyxxx

(o Y o)
Reaction score
64
you can send me the map in PM or here if u want too if u are still having problems by the time you read this. im gonna experiment a bit with offsetting the camera, may be a way to do it with just rotation modifications first without having to have an extra unit being moved around.
 

wingdnosring

New Member
Reaction score
16
I changed it to follow. This is exactly what happened the last time I tried the follow method.

I run this and no longer pan.

Code:
        Camera - Follow for player 1 (Unit group(Squad Units[1][1])) with the camera and Clear Current Target

I can't send you the map because my attachment limit would be surpassed. The map is too big now for me to have one version of it on the first post and another in progress version.

I notice two different problems that are really annoying with this method. Your map doesn't have these issues but mine does and it's driving me nuts:

1. It takes a long time for the camera to start following the unit. Often my unit reaches the edge of the screen before the camera snaps to it.

2. The marine's movement is really jerky. I'm not quite sure why that is. It almost seems like the marine is moving side to side in the direction he's moving. So if I'm moving forward it stutters forwards and backwards. If he's moving left, he keeps jumping side to side. He moves the right direction, it's more of a cosmetic bug.

I tried running the movement trigger via a while loop, like yours, to see if that made a difference. It was the exact same.

To Onisagi: You mentioned changing custom Actions to have an interface layout. Care to elaborate on that a bit?
 

onisagi

New Member
Reaction score
6
Well you know how inside the editor UI yu can click thru the Actions they predefined from default libraries and then click on UI to change different parameters for each action?

when you create an action definition the field to do this feature is under:
"Grammar Text", uncheck Use Default Grammar Text, and you'll be able to define your own grammar text for your custom action.

Like my traceline action has:

Grammar Text: Trace a line from the Camera Position at Camera Height for Player

or my old lob action had this:

Grammar Text: Lob a Projectile Type with Initial Speed from Launch Position and Launch Height by Player using animation Step Size (stepSize = 0.01 recommended).

This makes your action definitions much more user friendly and usable by a wider audience.
 

wingdnosring

New Member
Reaction score
16
I just rewrote a larger portion of my bullet creation code. Somehow I inadverteantly discovered the cause of bullets being created at such odd heights. For some reason, adjusting the facing angle of the bullets was creating that weird effect...don't ask me why.

Anyways, now instead of dropping from the sky, they come upwards from the player's feet. Still not ideal, but better.

I also slightly lessened the amount of code behind bullet creation. In addition to this, I managed to completely remove any and all references to vespene or minerals. So anybody using my library can feel free to use them (finally).

I'm working on the theoretical shooting (AKA Instant Shooting) now. It will be an option when creating weaponry. My hope is that I can finally use beam effects as trails, but we'll see. The current method of shooting will still be available though.

[Edit]: Ah...after several hours of trying to get these damn instant bullets to work, I have come to the realization that while statements don't run within "Pick Each Unit in Unit Group" action. That makes this far more difficult....
 

Sensang

TH.net Regular
Reaction score
7
[Edit]: Ah...after several hours of trying to get these damn instant bullets to work, I have come to the realization that while statements don't run within "Pick Each Unit in Unit Group" action. That makes this far more difficult....

Oh how I hate this fact... There's just no logic behind that.
Please tell us if you come up with an idea on how to by-pass that.
 

SerraAvenger

Cuz I can
Reaction score
234
It is possible to emulate an inner loop with an if statement.

Pick unit in unit group and do... is compiled very strange.
JASS:
    UnitGroupLoopBegin(UnitLastCreatedGroup());
    while (!UnitGroupLoopDone()) {
        UnitGroupLoopStep();
    }
    UnitGroupLoopEnd();


Also you could just try to loop thru the group whith a simple while statement...

EDIT: the for loop does exactly that:
JASS:
#AUTOVAR(g, unitgroup) = #PARAM(group);
#AUTOVAR(u) = 1;
while (#AUTOVAR(u) &lt;= UnitGroupCount(#AUTOVAR(g), c_unitCountAll)) {
    #PARAM(var) = UnitGroupUnit(#AUTOVAR(g), #AUTOVAR(u));
    #SUBFUNCS(actions)
    if (#PARAM(var) == UnitGroupUnit(#AUTOVAR(g), #AUTOVAR(u))) {
        #AUTOVAR(u) = #AUTOVAR(u) + 1;
    }
}

I don't see the necessity of creating a new unitgroup variable here, but it should be fine.
This line: [LJASS]if (#PARAM(var) == UnitGroupUnit(#AUTOVAR(g), #AUTOVAR(u))) {}[/LJASS] is awesome. I started coding a similar action for you, but then noticed that there already is one in the Ntve library. I would've forgotten to add such a line though :shame:.

EDIT2: Now that I think about it, I guess that line will eventually cause a lot of trouble to someone :evil_giggle:
 

wingdnosring

New Member
Reaction score
16
One way to bypass issues like that that I have tried in the past is the Index function.

Instead of picking all units in a unit group, run a for each integer loop that goes from 1 to the number of units in your group. Then, instead of using picked unit, use Unit From Unit Group, which identifies units by number.

It's essentially the same thing as Pick every unit in unit group, but it often gets around stupid limitations like this. The problem I encountered (you're not going to believe this) was that when I used my index method, I got a script error while saving. The reason behind the error? My trigger was too long for the editor to handle (or one function was too long).

Example of the Index Function:

For Each Integer <i> from 1 to number of units in <Generic Unit Group>
Loop
Unit - Make Unit <i> from <Generic Unit Group> Dance
End Loop

Also, keep in mind that this function can be used when giving orders to unit groups within another unit group. So something like this could work:

Pick each unit in <starting unit group> and do actions
set <Generic Unit Group> to (blah, blah, blah)
For Each Integer <i> from 1 to number of units in <Generic Unit Group>
Loop
Unit - Make Unit <i> from <Generic Unit Group> Dance
End Loop

[Edit]: I've got a question for everybody. Is there a way to run an action of some sort the instant a unit reaches ground level? Right now I detect hitting the gorund every 0.06 seconds, but that's a little too slow, since alot of the impact effects are showing up below ground level.
 

onisagi

New Member
Reaction score
6
do you know what i mean by Grammar Text now?

For the collision: If its a projectile, check for collision before actually moving your projectile. If your check on the next point passes the ground, exit loop. You can also make "ground level" a little higher, just to make sure its above ground.

I think the lagging behind vs trick's camera is due to unit move speed. His camera speed is keeping up with his unit speed.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top