Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Test Builds => Topic started by: Bobboau on March 08, 2004, 12:45:32 am

Title: revamped fighter beam code
Post by: Bobboau on March 08, 2004, 12:45:32 am
ok the old fighter beam code was basicly the uggliest hack in exsistance and only half worked, as a result they never worked quite right, so I give you my new and improved fighter beam code (http://freespace.volitionwatch.com/blackwater/fs2_open_Bobboau_3-14-04.zip), I actualy did things corectly this time and fighter beams work just as you would think, well type 2 and 4 (fighter and moljoner) the other ones still need a bit of work.

I'm not sure were this fits, it isn't a new feature and it fixes most of the nasty nasty problems fighter beams had, but it was a lot of new code, and I had origonaly planed on doing this after 3.6. fortunately it was a lot easier than I thought it was going to be.

I havn't included any tables, but keep in mind it now actualy looks at a lot of the values it used to ignor (like warmup/down and lifetime (targeting beam has a life of 0 so it will only blink on and off, you _will_ need to make your own))
Title: revamped fighter beam code
Post by: Killfrenzy on March 08, 2004, 06:01:41 am
*Downloads*

Can I ask, is the cel-shading code still in there? If so how do I activate it?
Title: revamped fighter beam code
Post by: Bobboau on March 08, 2004, 07:17:08 am
it's still there but it only works in non-htl mode
Title: revamped fighter beam code
Post by: Omniscaper on March 08, 2004, 10:09:38 pm
Downloading now. Is the sound bug fixed? I had sound loop problems when the energy is drained out.
Title: revamped fighter beam code
Post by: Bobboau on March 09, 2004, 07:26:24 am
yup, been totaly reworked
Title: revamped fighter beam code
Post by: Zarax on March 09, 2004, 08:06:15 am
Great work Bobbau, now i can make something useful for my vasudan fighters :-)
Title: revamped fighter beam code
Post by: phreak on March 09, 2004, 11:04:11 am
have you committed this?
Title: revamped fighter beam code
Post by: Killfrenzy on March 09, 2004, 11:55:53 am
Quote
Originally posted by Bobboau
it's still there but it only works in non-htl mode


How do I do that? Is it in the launcher? *Is clueless*
Title: revamped fighter beam code
Post by: kasperl on March 09, 2004, 12:20:58 pm
-nohtl in the custom flags field, IIRC.
Title: revamped fighter beam code
Post by: Killfrenzy on March 09, 2004, 03:58:15 pm
Okay, thanks. I'll try that. :)
Title: revamped fighter beam code
Post by: Bobboau on March 09, 2004, 06:26:02 pm
I don't think it's been commited, but that's only becase CVS was down.
Title: revamped fighter beam code
Post by: SadisticSid on March 12, 2004, 02:30:08 pm
This is way cool, but can you also make a change in FRED to allow fighterbeams to be selectable as a primary weapon for fighters? Right now one has to manually change this in Notepad. I'm not sure if FS2 allows you to select them in the ship/weapon config screens either...
Title: revamped fighter beam code
Post by: Bobboau on March 12, 2004, 09:57:07 pm
well given that you need to make entierly new weapons table entree(s) to get this to realy work. I don't even know exactly what you want, they should be selectable as any other weapon, but you have to make a new one.
Title: revamped fighter beam code
Post by: SadisticSid on March 13, 2004, 06:46:18 pm
Oh, my mistake, they are selectable in FRED. Just didn't have the right flags and they were in the wrong place in the TBL. :)

Has this been commited yet?
Title: revamped fighter beam code
Post by: Zarax on March 13, 2004, 06:48:54 pm
Some updates to the Wiki example for we lazy people? :-)
Title: revamped fighter beam code
Post by: phreak on March 13, 2004, 08:32:27 pm
go ahead.  im not stopping you
Title: revamped fighter beam code
Post by: Bobboau on March 14, 2004, 03:04:22 am
http://freespace.volitionwatch.com/blackwater/fs2_open_Bobboau_3-14-04.zip

new build, small number of minor bug fixes
Title: revamped fighter beam code
Post by: SadisticSid on March 14, 2004, 07:40:00 am
Some small bugs using that build:

a) Beams power down mid-shot if there's not enough power to use them, but the energy keeps draining from the fighter's weapon energy (into minus figures) during the warmup and warmdown parts

b) Should beams supposed to be draining energy in the warmdown at all?

c) Player beams ignore fire wait, you can seem to fire another salvo after some fixed time, although the AI is fine with this

d) Beams don't obey the "cycle" tag, although funnily enough the particle effect only occurs around one of the model's gunpoints
Title: revamped fighter beam code
Post by: Bobboau on March 14, 2004, 12:33:15 pm
they follow fire wait, they will fire a beam every time weather you have finished the previus shot or not, this enables you to make beams capable of a overload typ thing, fighter beams also have a diferent implementation of cycle, you need to give the beam shots (its a value in the beam info, look at a post I made recently on TBP forums for an example)

I had the beam draining power the entier time they were doing anything though I supose they shouldn't be draining during warm down, that probly explains the reason why AI don't seem to be useing them as much as they used to.
Title: revamped fighter beam code
Post by: SadisticSid on March 14, 2004, 01:50:51 pm
It doesn't, low values work (<5 seconds) but higher ones (10.0 for example) are ignored and you can fire 1 every second. Try it with your Nial beam.

Also the firepoints don't alternate, is this intentional?
Title: revamped fighter beam code
Post by: Taristin on March 14, 2004, 02:01:18 pm
...I think that's what he's talking about with the overload stuff... But then again, I have no idea.

Anyone want to post a tbl entry so us lazy buggers can try?
Title: revamped fighter beam code
Post by: SadisticSid on March 14, 2004, 02:04:29 pm
Code: [Select]
$Name:                          GB Cannon
+Title:                         XSTR("Neutron Gun", -1)
+Description:
XSTR(
"Fires a stream of neutrons.
Level 3 Hull Damage ", -1)
$end_multi_text
+Tech Title:                    XSTR("Neutron Gun", -1)
+Tech Anim:                     Tech_Subach_HL-7
+Tech Description:
XSTR(
"Minbari Neutron guns cause molecular decay on the targets hull plating. Using powerful gravimetrics to control the confinement of the beam, Minbari craft use this to great advantage and are able to bring significant firepower on their target.", -1)
$end_multi_text
$Model File:                  none
@Laser Bitmap:newglo6
@Laser Color:190, 150, 250
@Laser Length:10.0
@Laser Head Radius:0.90
@Laser Tail Radius:0.30
$Mass:                          0.2
$Velocity:                    1100
$Fire Wait:                   10
$Damage:                      20
$Armor Factor:                1.0
$Shield Factor:               0.7
$Subsystem Factor:            0.7
$Lifetime:                    1.1
$Energy Consumed:             9;this is only getting fired by one point at a time
$Cargo Size:                  0.0
$Homing:                      NO
$LaunchSnd:                   84
$ImpactSnd:                   85
+Weapon Range:                1800
$Flags:                       ( "beam" "in tech database" "player allowed" )
$Icon:                        iconSD4
$Anim:                        SD4
$Impact Explosion:              ExpMissileHit1
$Impact Explosion Radius:       5.5
$BeamInfo:
      +Type:                        3
      +Life:                        0.15
      +Warmup:                      100
      +Warmdown:                    100
      +Radius:                      4.0
      +PCount:                      0
      +PRadius:                     0.0
      +PAngle:                      0.0
      +PAni:                        particleexp01
      +Miss Factor:                 0.5 0.7 0.9 1.1 1.3
      +BeamSound: 84
      +WarmupSound:                 151
      +WarmdownSound:               157
      +Muzzleglow:                  beamglow3
      +Shots:                       1
      +ShrinkFactor:                0.0
      +ShrinkPct:                   0.0
$Section: ;; one section of the beam (you can have up to 5)
+Width: 0.25 ;; width of the section
+Texture: beam-red ;; texture for this section
+RGBA Inner: 255 255 255 255 ;; rgba values (only for non-textured beam compiles)
+RGBA Outer: 150 150 150 10 ;; rgba values (only for non-textured beam compiles)
+Flicker: 0.0 ;; how much it flickers (0.0 to 1.0)
+Zadd: 4.0 ;; hehe
$Section: ;; one section of the beam
+Width: 0.5 ;; width of the section
+Texture: beam-green2 ;; texture for this section
+RGBA Inner: 160 160 0 255 ;; rgba values (only for non-textured beam compiles)
+RGBA Outer: 60 60 0 10 ;; rgba values (only for non-textured beam compiles)
+Flicker: 0.45 ;; how much it flickers (0.0 to 1.0)
+Zadd: 3.0 ;; hehe
$Section: ;; one section of the beam (you can have up to 5)
+Width: 1 ;; width of the section
+Texture: beam-green ;; texture for this section
+RGBA Inner: 255 255 255 255 ;; rgba values (only for non-textured beam compiles)
+RGBA Outer: 150 150 150 10 ;; rgba values (only for non-textured beam compiles)
+Flicker: 0.4 ;; how much it flickers (0.0 to 1.0)
+Zadd: 2.0 ;; hehe
$Section: ;; one section of the beam
+Width: 1.7 ;; width of the section
+Texture: beam-green3 ;; texture for this section
+RGBA Inner: 255 0 0 255 ;; rgba values (only for non-textured beam compiles)
+RGBA Outer: 60 0 0 10 ;; rgba values (only for non-textured beam compiles)
+Flicker: 0.5 ;; how much it flickers (0.0 to 1.0)
+Zadd: 0.0 ;; hehe


That was what I was using (Bob's Nial beam with some modifications to check if it worked with other values), see if it's just me that's got problems
Title: revamped fighter beam code
Post by: Taristin on March 14, 2004, 02:20:16 pm
Fired with a one to one and a half second interval. :nod:
Title: revamped fighter beam code
Post by: Mav on March 14, 2004, 03:32:13 pm
Just an idea - maybe it gets problems if you tell it to fire from more points at once than are available? :confused:
Title: revamped fighter beam code
Post by: Taristin on March 14, 2004, 03:58:06 pm
I want to know why it doesn't use the ship's own gunpoints for these beams.
Title: revamped fighter beam code
Post by: Bobboau on March 14, 2004, 04:43:12 pm
it doesn't?
Title: revamped fighter beam code
Post by: SadisticSid on March 14, 2004, 06:21:13 pm
Actually the fire wait thing isn't a problem with Bob's code, it happens with ALL primary weapons, as I've just tested the Aquila cannon from Inferno and it does the same thing =/ any value above 5 or so makes it default to the 1-2 second fire wait than Raa and me have experienced.
Title: revamped fighter beam code
Post by: Taristin on March 14, 2004, 09:26:57 pm
Quote
Originally posted by Bobboau
it doesn't?


Err.. . It may just be that one beam type I tested, but it fired from the top left of the cocpit. (On the top right from outside view)

with dual fire, it fired the two with a small space between them.
Title: revamped fighter beam code
Post by: Bobboau on March 14, 2004, 11:44:48 pm
did you have a subsystem selected on your target?
Title: revamped fighter beam code
Post by: Taristin on March 15, 2004, 07:49:09 am
I doubt it. I was targetting fighters.
Title: revamped fighter beam code
Post by: Trivial Psychic on March 15, 2004, 01:47:16 pm
Does this build have the same afterburner trail code from the 3-7-2004 build?
Title: revamped fighter beam code
Post by: Bobboau on March 15, 2004, 01:51:48 pm
yeah
Title: revamped fighter beam code
Post by: Nuke on March 15, 2004, 11:08:48 pm
whenever a weapon cycles more than one point at a time (weather it be with a beam or a weapon with "cycle") it tends to ocassionally fire a shot from from the center of the ship.

this happens with my ancients fighter, it has a ring of 21 firing points and i want to fire 3 at a time. the points are setup so that it will fire in a rotating triangular pattern. the only problem is that the code creates an extra point and breaks the pattern. at first i though it was a point limit. but while messing with the new beam code i noticed that the bug exists there as well, i also noticed that it does it no matter haw many firing points a ship has.

it seems like a ****ing error in a loop (when a loop starts counting at 0 when the programmer thinks it will start a 1 or vice versa). its a mistake i made alot in computer science. i could imagine it looping around and trying to fire when it hant anything to fire from.
Title: revamped fighter beam code
Post by: SadisticSid on March 16, 2004, 02:55:25 am
How do you get beams to cycle through firepoints anyway?
Title: revamped fighter beam code
Post by: Nuke on March 16, 2004, 02:58:37 am
with $shots: in the beam section.
Title: revamped fighter beam code
Post by: SadisticSid on March 16, 2004, 04:42:36 am
Ah it sort of works, in that 2 out of the 4 gunpoints on an Erinyes actually alternate. ^_^ Must be the same sort of problem as you're having, Nuke. I wondered what was going on as I was using a Ulysees with only 2 points per bank, and it was always firing from the first point only.
Title: revamped fighter beam code
Post by: Bobboau on March 16, 2004, 10:55:01 am
I found what waqs causeing the alternateing thing, but I don't have time to upload a build right now
Title: revamped fighter beam code
Post by: Nuke on March 16, 2004, 04:46:41 pm
cool
Title: revamped fighter beam code
Post by: Carl on March 17, 2004, 12:16:09 am
is it possible to make it so i the beam will continously fire while i have the trigger down, then stop when i let go, like it was before?
Title: revamped fighter beam code
Post by: Carl on March 17, 2004, 12:17:57 am
*deleted*
Title: revamped fighter beam code
Post by: Bobboau on March 17, 2004, 12:27:57 am
fire wait and life of 0 would probly do it, I supose I sould put in a diferent flag or something for that
Title: revamped fighter beam code
Post by: Carl on March 17, 2004, 12:35:03 am
Quote
Originally posted by Bobboau
fire wait and life of 0 would probably do it


nope. the beam just doesn't fire.

Quote
Originally posted by Bobboau
I suppose I should put in a different flag or something for that


I would appreciate it.
Title: revamped fighter beam code
Post by: Bobboau on March 17, 2004, 12:56:57 am
try a life of .0001

no that doesn't work either, I'll have to add that in later, but I'm not sure if it's going to get done before 3.6