Request for comments: UniversalWeapon
Moderator: Moderators
Request for comments: UniversalWeapon
UniversalWeapon
Summary:
The UniversalWeapon will be a weapon capable of replacing any existing weapontype. It will use submodules that can be combined to get any desired behaviour. Every hardpoint can use a Lua function
UniversalWeapon plugin "hardpoints"
[*]Target finder
[*][*]Any target
[*][*]Manual
[*]LOF verifier (TryTarget)
[*][*]Line
[*][*]Ballistic trajectory
[*][*]Unrestricted
[*]Aimer
[*][*]Direct
[*][*]Coaxial
[*][*]UnitHeading
[*][*]Piece
[*][*]Fixed
[*][*]MaintainBurstDirection
[*]Launcher
[*][*]Projectile
[*][*]Beam
[*][*]Instahit
UniversalWeaponProjectile hardpoints
[*]InFlight (movement along speed vector is implicit) (can use any number)
[*][*]Accelerate
[*][*]Ballistic
[*][*]Arc Trajectory
[*][*]Guided
[*][*]InertiaGuided
[*][*]TurnToward (accepts event to execute when turn is finished)
[*][*]Spawn Projectile
[*]Event (hit unit/ground/water, timeout) (can use any number)
[*][*]Explode
[*][*]Destroy (not implicit in Explode)
[*][*]Bounce
[*][*]Spawn Projectile
[*][*]SetTimer
[*][*]SetTrajectory
[*][*]SetEvent
[*][*]SetDraw
[*]Draw (can use any number)
[*][*]Model
[*][*]Trail
[*][*]CEG
[*][*]Laser
[*][*]Sprite
Summary:
The UniversalWeapon will be a weapon capable of replacing any existing weapontype. It will use submodules that can be combined to get any desired behaviour. Every hardpoint can use a Lua function
UniversalWeapon plugin "hardpoints"
[*]Target finder
[*][*]Any target
[*][*]Manual
[*]LOF verifier (TryTarget)
[*][*]Line
[*][*]Ballistic trajectory
[*][*]Unrestricted
[*]Aimer
[*][*]Direct
[*][*]Coaxial
[*][*]UnitHeading
[*][*]Piece
[*][*]Fixed
[*][*]MaintainBurstDirection
[*]Launcher
[*][*]Projectile
[*][*]Beam
[*][*]Instahit
UniversalWeaponProjectile hardpoints
[*]InFlight (movement along speed vector is implicit) (can use any number)
[*][*]Accelerate
[*][*]Ballistic
[*][*]Arc Trajectory
[*][*]Guided
[*][*]InertiaGuided
[*][*]TurnToward (accepts event to execute when turn is finished)
[*][*]Spawn Projectile
[*]Event (hit unit/ground/water, timeout) (can use any number)
[*][*]Explode
[*][*]Destroy (not implicit in Explode)
[*][*]Bounce
[*][*]Spawn Projectile
[*][*]SetTimer
[*][*]SetTrajectory
[*][*]SetEvent
[*][*]SetDraw
[*]Draw (can use any number)
[*][*]Model
[*][*]Trail
[*][*]CEG
[*][*]Laser
[*][*]Sprite
Re: Request for comments: UniversalWeapon
Good idea. Should allow to make exploding sheep, banana bombs and other fun stuff. Super sheep will need to change trajectory from Lua to work (i.e. you'll need to be able to modify heading and velocity of a fired projectile - I see that you've already listed SetTrajectory, but I'm not sure if that's that.)
Re: Request for comments: UniversalWeapon
SetTrajectory is a fixed event that replaces/adds/removes a Trajectory module (e.g. replace guidance with ballistic once the flight time ends, replace accelerate with turntowards for vlaunch, ...), I'm planning a Lua module (i.e. a class that just forwards all calls to Lua) for every hardpoint that would be used for things you cannot express with the available modules.
Re: Request for comments: UniversalWeapon
Oh. The name is confusing, then - SetFlightController or something similar would be better. SetTrajectory suggest that you could e.g. set waypoints for a missile.
Re: Request for comments: UniversalWeapon
Blendmodes for sprite weapons, overlay and additive at least.
Re: Request for comments: UniversalWeapon
The ability to attach units and features? Imagine a wave blasting away trees and carrying them along and depositing them in a nearby harbour where they slowly sink, or jumping from unit to unit.
Re: Request for comments: UniversalWeapon
IMO it would be nice with a weapon fully integrated with LUA. For starters a way to keep track of where the projectile is like with units. Also ability to set all the parameters in LUA would be nice, like position and all that for projectiles but also damage range, etc for the weapon dynamically. Then I would consider going back from using my own hacked together LUA weapons in my project.
Re: Request for comments: UniversalWeapon
What will those options do? Some of their names aren't clear enough for me. Is Coaxial meant for weapons that can only aim in the direction their 'master' weapon aims? Will UnitHeading mean it can only aim where the unit is facing (sort of like turret=0 weapons do now)?KDR_11k wrote:UniversalWeapon
...
[*]Aimer
[*][*]Direct
[*][*]Coaxial
[*][*]UnitHeading
[*][*]Piece
[*][*]Fixed
[*][*]MaintainBurstDirection...
Why I ask all of that: suppose I want to make a unit like this:

As you can see, it has a machinegun on the back of turret, that can only fire in the opposite direction from the main gun (it has a coax MG with the main gun, too). So basically it's like WeaponMainDir=0 0 -1, only (0,0,0) vector being not the unit heading, but current turret position.
Will something like that be possible with that proposed system? Because ATM such a unit is scriptable, but the limitations would mean that MG on the back will almost never be able to fire.
Re: Request for comments: UniversalWeapon
Direct = firepoint to target
Coaxial = aimpoint to target (OTA behaviour, I'Ve heard)
Heading = turret = 0, yes
Piece = piece orientation
Fixed = fixed vector
MaintainBurst = Make sure later shots in a burst aim in the same direction as the first
The Aimer would just determine the direction the shot is fired in.
Slave weapons aren't part of the proposal yet, I think those would work under target finder or something.
Coaxial = aimpoint to target (OTA behaviour, I'Ve heard)
Heading = turret = 0, yes
Piece = piece orientation
Fixed = fixed vector
MaintainBurst = Make sure later shots in a burst aim in the same direction as the first
The Aimer would just determine the direction the shot is fired in.
Slave weapons aren't part of the proposal yet, I think those would work under target finder or something.
Re: Request for comments: UniversalWeapon
I mentioned abstracting the weapons into a base type but trepan told me that it would be OO overkill.
Re: Request for comments: UniversalWeapon
There must have been more arguments to that, there already is a weapon base class, but it sucks
Re: Request for comments: UniversalWeapon
A basic weapon that had no real attributes and instead relied on a lua script to implement its functionality would be best imo.
Re: Request for comments: UniversalWeapon
I disagree, Trepan objected top lua-projectile interfacing because that'd just be horribly slow due to the number of propjectiles in play. It'd suck to have to reimplement everything in Lua just because you want one behaviour slightly different.
Re: Request for comments: UniversalWeapon
even if all you wanted was a very simple particle?
Re: Request for comments: UniversalWeapon
Looks great, I really couldn't come up with anything new to add. Looks like just about all of the requests are in there, frankly, this makes me rub my hands together with glee, anticipating making wild new weapons that actually do something new for a change 

Re: Request for comments: UniversalWeapon
I see one useful tag that could be added, a cruisealtitude tag so a projectile will try to maintain a certain distance above the ground/water.
Re: Request for comments: UniversalWeapon
Why is this a problem if things like spammed flashes EMGs are still handled by simple hardcoded stuff, but when you want to make say a complicated MIRV nuke or heatseeking missle, you don't have to do the whole thing in LUA from ground up or resort to some epic hack?KDR_11k wrote:I disagree, Trepan objected top lua-projectile interfacing because that'd just be horribly slow due to the number of propjectiles in play. It'd suck to have to reimplement everything in Lua just because you want one behaviour slightly different.
On the other hand, When I think of it, you'd basically be doing that anyway even if you could get some assistance by the engine... The main thing that would be nice is if you didn't have to mess with unit behaviour, but could basically get a weapon fired, and then handle it from there in LUA.
I admit I don't really understand how this whole system will work out, with the hardpoints and how exactly it will tie in with LUA and what you will be able to do.