Author Topic: Burner trails  (Read 7364 times)

0 Members and 1 Guest are viewing this topic.

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
ok I've gotten after burner trails to work, they still need some tweakage, and some of the values I am going to recode so they can be specifyed through the ships table, but the main bulk of the code I have done now shouldn't change too much

allright in ShipContrails.cpp I added a bunch of new functions wich do basicly the same thing as the ones in there now but rather than doing the nebula trails it does the ABtrails

new forward declairations (these go at the top of the file right under the ones there now)
Code: [Select]

// determine if the ship has AB trails
int ct_has_ABtrails(ship *shipp);

// update active ABtrails - moving existing ones, adding new ones where necessary
void ct_update_ABtrails(ship *shipp);

// create new ABtrails
void ct_create_ABtrails(ship *shipp);



made changes to ct_ship_create so it will initalise both neb trails and ABtrails
Code: [Select]

// call when a ship is created to initialize its contrail stuff
void ct_ship_create(ship *shipp)
{
int idx;
Assert(shipp != NULL);

// null out the ct indices for this guy
for(idx=0; idx shipp->trail_num[idx] = (short)-1;
}

for(idx=0; idx shipp->ABtrail_num[idx] = (short)-1;
}


}



a similar thing here
Code: [Select]

// call when a ship is deleted to free up its contrail stuff
void ct_ship_delete(ship *shipp)
{
int idx;

Assert(shipp != NULL);
// free up any contrails this guy may have had
for(idx=0; idx if(shipp->trail_num[idx] >= 0){
trail_object_died(shipp->trail_num[idx]);
shipp->trail_num[idx] = (short)-1;
}
if(shipp->ABtrail_num[idx] >= 0){
trail_object_died(shipp->ABtrail_num[idx]);
shipp->ABtrail_num[idx] = (short)-1;
}
}
}


add this to the first line in ct_ship_process
Code: [Select]

ct_ship_process_ABtrails(shipp);//seems like as good a place as any -Bobboau



here's the real meat of the code, the ABtrail proces, creation, and updateing code, this is all below everything else
Code: [Select]


// call each frame for processing a ship's ABtrails
void ct_ship_process_ABtrails(ship *shipp)
{
int idx;
object *objp;

Assert(shipp != NULL);
Assert(shipp->objnum >= 0);
objp = &Objects[shipp->objnum];

// if this is not a ship, we don't care
if((objp->type != OBJ_SHIP) || (Ship_info[Ships[objp->instance].ship_info_index].ct_count <= 0)){
return;
}

Assert(objp->instance >= 0);
shipp = &Ships[objp->instance];


if(!(objp->phys_info.flags & PF_AFTERBURNER_ON)){ //if the after burners aren't on -Bobboau
for(idx=0; idx trail_object_died(shipp->ABtrail_num[idx]);
shipp->ABtrail_num[idx] = (short)-1;
}
}

// if the object already has ABtrails
if(ct_has_ABtrails(shipp)){
ct_update_ABtrails(shipp);
}
// otherwise add new ones
else {
ct_create_ABtrails(shipp);
}

/* if(shipp->ab_info->stamp > timestamp( (int)(shipp->ab_info->max_life * 1000) )  ){
for(idx=0; idx if(shipp->ABtrail_num[idx] >= 0){
trail_object_died(shipp->ABtrail_num[idx]);
shipp->ABtrail_num[idx] = (short)-1;
}
}
}
*/
}



// create new ABtrails
void ct_create_ABtrails(ship *shipp)
{
vector v1;
int idx;
matrix m;
ship_info *sip;
object *objp;

// get object and ship info
Assert(shipp != NULL);
Assert(shipp->objnum >= 0);
Assert(shipp->ship_info_index >= 0);
objp = &Objects[shipp->objnum];
sip = &Ship_info[shipp->ship_info_index];

// get the inverse rotation matrix
vm_copy_transpose_matrix(&m, &objp->orient);


if(objp->phys_info.flags & PF_AFTERBURNER_ON){//AB trails-Bobboau

for(idx=0; idxab_count; idx++){

shipp->ABtrail_num[idx] = (short)trail_create(shipp->ab_info[idx]);
// get the point for the contrail
vm_vec_rotate(&v1, &shipp->ab_info[idx].pt, &m);
vm_vec_add2(&v1, &objp->pos);
// if the spew stamp has elapsed
if(trail_stamp_elapsed(shipp->ABtrail_num[idx])){
trail_add_segment(shipp->ABtrail_num[idx], &v1);
trail_set_stamp(shipp->ABtrail_num[idx]);
} else {
trail_set_segment(shipp->ABtrail_num[idx], &v1);
}
}
/* if( objp == Player_obj){
HUD_printf("trailnum %d", shipp->ABtrail_num[0]);
}
*/

}
}

// update active ABtrails - moving existing ones, adding new ones where necessary
void ct_update_ABtrails(ship *shipp)
{
vector v1;
matrix m;
int idx;
ship_info *sip;
object *objp;

// get object and ship info
Assert(shipp != NULL);
Assert(shipp->objnum >= 0);
Assert(shipp->ship_info_index >= 0);
objp = &Objects[shipp->objnum];
sip = &Ship_info[shipp->ship_info_index];

// get the inverse rotation matrix
vm_copy_transpose_matrix(&m, &objp->orient);

for(idx=0; idx if(objp->phys_info.flags & PF_AFTERBURNER_ON){//ABtrails
if(shipp->ABtrail_num[idx] >= 0){
// get the point for the contrail
vm_vec_rotate(&v1, &shipp->ab_info[idx].pt, &m);
vm_vec_add2(&v1, &objp->pos);

// if the spew stamp has elapsed
if(trail_stamp_elapsed(shipp->ABtrail_num[idx])){
trail_add_segment(shipp->ABtrail_num[idx], &v1);
trail_set_stamp(shipp->ABtrail_num[idx]);
} else {
trail_set_segment(shipp->ABtrail_num[idx], &v1);
}
}
}

}
}


// if a ship has active ABtrails
int ct_has_ABtrails(ship *shipp)
{
int idx;

for(idx=0; idx if(shipp->ABtrail_num[idx] >= 0){
return 1;
}
}

// no contrails
return 0;
}





add this to the end of ShipContrails.h
Code: [Select]

// call each frame for processing a ship's contrails
void ct_ship_process_ABtrails(ship *shipp);

// determine if the ship has AB trails
int ct_has_ABtrails(ship *shipp);

// update active ABtrails - moving existing ones, adding new ones where necessary
void ct_update_ABtrails(ship *shipp);

// create new ABtrails
void ct_create_ABtrails(ship *shipp);



there now you have all the code for handeling the trails, but we still need to make chages to the ship structure in ship.h
these need to be added
Code: [Select]

short ABtrail_num[MAX_SHIP_CONTRAILS]; //after burner trails -Bobboau
trail_info ab_info[MAX_SHIP_CONTRAILS];

int ab_count;



now this following code is subject to change, it assigns the inital values for the ABtrails, things like position are going to remain hard coded, things like the bitmap and posably max life are defonantly going into the table, things like width alpha, I might make a factoring value

this goes into ship_create down near the bottom just before the ct_ship_create(shipp);
Code: [Select]

trail_info *ci;
//first try at ABtrails -Bobboau
shipp->ab_count = 0;
//if(sip->flags & SIF_AFTERBURNER){

for(int h = 0; h < pm->n_thrusters; h++){

for(int j = 0; j < pm->thrusters->num_slots; j++){
// this means you've reached the max # of AB trails for a ship
Assert(sip->ct_count <= MAX_SHIP_CONTRAILS);

ci = &shipp->ab_info[shipp->ab_count++];
// ci = &sip->ct_info[sip->ct_count++];

ci->pt = pm->thrusters[h].pnt[j];//offset

ci->w_start = pm->thrusters[h].radius[j];//width

ci->w_end = 0.05f;//end width

ci->a_start = 1.0f;//start alpha

ci->a_end = 0.0f;//end alpha

ci->max_life = 5.0f;//max life

ci->stamp = 60; //spew time???

ci->bitmap = bm_load("ABtrail");
//loading this bitmap as default for now,
//I might add this to the afterburner section of the ships.tbl later
}
}
//}//end AB trails -Bobboau



remember my executable is right here, also in there are the other things I have done to date, the code is currently being beta tested, make sure you have no mods instaled and make a new pilot,
you stand about a %50 chance of this not crashing good luck ;)
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Ashrak

  • Not Banned
  • 210
    • Imagination Designs
50% lol :)

EDIT ok its like 0% for me

Assert: ship_count <= MAX_SHIP_TYPES
File: D:\Games\projects\freespace2_public\code\Playerman\ManagePilot.cpp
Line: 478

Call stack:
------------------------------------------------------------------
    FS3.exe 005644b0()
    FS3.exe 0056686d()
    FS3.exe 004385de()
    FS3.exe 00504c21()
    FS3.exe 004377b1()
    FS3.exe 0050508e()
    FS3.exe 0043a2ec()
    FS3.exe 0043a36e()
    FS3.exe 00651a96()
    kernel32.dll 77e7eb69()
------------------------------------------------------------------
« Last Edit: September 21, 2002, 03:09:43 am by 544 »
I hate My signature!

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
see if makeing a new pilot fixes this
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 
Still no stat icon error but it works
Oh yeah afterburner trails... nice for a start! I'd likem to be a little longer maybe 1/4 more?

:cool:
Don't think of it as being outnumbered. Think of it as having a wide target selection !

ICQ#: 5256653
[email protected]

Projects: Gundam TC, Trek BTFF, REF, and Beyond Redemption
http://photo.starblvd.net/Star_Dragon

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
I'm working on makeing them a lot more customisable, in my next build you will be able to define the values for the bitmap, relitive width, starting alpha, and life, on a ship by ship basis, I'm makeing the preleminary build now, after a bit of testing I'll make a clean build and I'll update the EXE post the code changes.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
ok in the new tables it's gona look like this
Code: [Select]

$Trails:
+Bitmap: name of bitmap
+Width: relitive width of trail
+Alpha: starting alpha
+Life: life time in seconds


inside the after burner section
so for example
Code: [Select]

$Afterburner:           YES
+Aburn Max Vel: 0.0, 0.0, 150.0
+Aburn For accel:       0.7
+Aburn Fuel:            300.0
+Aburn Burn Rate:       50.0
+Aburn Rec Rate:        25.0
$Trails:
+Bitmap: ABtrail
+Width: 1.0
+Alpha: 1.0
+Life: 15

is what the Ulysses' afterburner section is going to be
if you include the $Trails: string you are going to have to specify all four of the values, if the $Trails: string is missing that ship will not have any trails
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline DragonClaw

  • Romeo Kilo India Foxtrot
  • 210
any screenshots for us with no compiling program/no time?

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline IceFire

  • GTVI Section 3
  • 212
    • http://www.3dap.com/hlp/hosted/ce
Pictures?  I'm a picture kind of guy :)
- IceFire
BlackWater Ops, Cold Element
"Burn the land, boil the sea, you can't take the sky from me..."

 

Offline Ashrak

  • Not Banned
  • 210
    • Imagination Designs
Quote
Originally posted by Bobboau
see if makeing a new pilot fixes this



thats the problem it wont go to main screen or make new pilot.....
I hate My signature!

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
try renameing the data file so it rebuilds everything,

ok new code
this replaces the afterburner parsing in the parse_ship() finction in ship.cpp
Code: [Select]

// Get Afterburner information
// Be aware that if $Afterburner is not 1, the other Afterburner fields are not read in
required_string("$Afterburner:");
int has_afterburner;
stuff_boolean(&has_afterburner);
if ( has_afterburner == 1 ) {
sip->flags |= SIF_AFTERBURNER;

required_string("+Aburn Max Vel:");
stuff_vector(&sip->afterburner_max_vel);

required_string("+Aburn For accel:");
stuff_float(&sip->afterburner_forward_accel);

required_string("+Aburn Fuel:");
stuff_float(&sip->afterburner_fuel_capacity);

required_string("+Aburn Burn Rate:");
stuff_float(&sip->afterburner_burn_rate);


required_string("+Aburn Rec Rate:");
stuff_float(&sip->afterburner_recover_rate);

if(optional_string("$Trails:")){//optional values aplyed to ABtrails -Bobboau

char bitmap_name[MAX_FILENAME_LEN] = "";

required_string("+Bitmap:");
stuff_string(bitmap_name, F_NAME, NULL);
sip->ABbitmap = bm_load(bitmap_name);

required_string("+Width:");
stuff_float(&sip->ABwidth_factor);

required_string("+Alpha:");
stuff_float(&sip->ABAlpha_factor);

required_string("+Life:");
stuff_float(&sip->ABlife);
}else{
sip->ABbitmap = -1; //defalts for no ABtrails
sip->ABwidth_factor = 1.0f;
sip->ABAlpha_factor = 1.0f;
sip->ABlife = 5.0f;
}


} else {
sip->afterburner_max_vel.x = 0.0f;
sip->afterburner_max_vel.y = 0.0f;
sip->afterburner_max_vel.z = 0.0f;

sip->ABbitmap = -1; //defalts for no ABtrails
sip->ABwidth_factor = 1.0f;
sip->ABAlpha_factor = 1.0f;
sip->ABlife = 5.0f;

}


this replaces the code I said was going to be redone in ship_create()
Code: [Select]

trail_info *ci;
//first try at ABtrails -Bobboau
shipp->ab_count = 0;
//if(sip->flags & SIF_AFTERBURNER){

for(int h = 0; h < pm->n_thrusters; h++){

for(int j = 0; j < pm->thrusters->num_slots; j++){
// this means you've reached the max # of AB trails for a ship
Assert(sip->ct_count <= MAX_SHIP_CONTRAILS);

ci = &shipp->ab_info[shipp->ab_count++];
// ci = &sip->ct_info[sip->ct_count++];

ci->pt = pm->thrusters[h].pnt[j];//offset

ci->w_start = pm->thrusters[h].radius[j] * sip->ABwidth_factor;//width * table loaded width factor

ci->w_end = 0.05f;//end width

ci->a_start = 1.0f * sip->ABAlpha_factor;//start alpha  * table loaded alpha factor

ci->a_end = 0.0f;//end alpha

ci->max_life = sip->ABlife;// table loaded max life

ci->stamp = 60; //spew time???

ci->bitmap = sip->ABbitmap; //table loaded bitmap used on this ships burner trails
}
}
//}//end AB trails -Bobboau



this is added the the ship_info structure
Code: [Select]

//optional ABtrail values
int ABbitmap; //the bitmap used
float ABwidth_factor; //a number that the width (set by the thruster glow width) will be multiplyed by
float ABAlpha_factor; //allows you to set how starting trasparency value
float ABlife; //how long the trails live for



the EXE has been updated

and here are some screens









Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 
Hey bobboau, could i get that targeting icon from you? ;)
Ich kann nicht eine Sache des Deutschen sprechen!!

 

Offline Solatar

  • 211
Same here, that is a nice targeting icon. You ever thought about doing a HUD redesign?

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
oh, forgot about that, it doesn't work right, it's too big, I need to adjust the coordanants, but if you all want it I'll upload it when I get back home
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Fury

  • The Curmudgeon
  • 213
Nice looking screens!

But...
-Can you make afterburner trails more transparent? They are a bit too visible in my opinion.
-Can anything be done to beam breaking? I mean the strange effect when you see small beams at distance, AAA and fighter beams for example. (http://freespace.volitionwatch.com/blackwater/trails03.jpg)

On another note... perhaps a better effect for trails would be more like smoke effect? Just a line coming out of thrusters seems strange...
« Last Edit: September 22, 2002, 11:20:01 am by 173 »

 

Offline IceFire

  • GTVI Section 3
  • 212
    • http://www.3dap.com/hlp/hosted/ce
Smoke effect...probably more of a visual thing with the trail PCX rather than the code itself.  Looks like a neat thing....does it just go out the back all the time or is it activated by afterburners?
- IceFire
BlackWater Ops, Cold Element
"Burn the land, boil the sea, you can't take the sky from me..."

 

Offline Fury

  • The Curmudgeon
  • 213
Right, but code defines how much room there is for visuality.
I don't know if it currently supports transparency and more fancy effects?

Activated by afterburners only.
« Last Edit: September 22, 2002, 12:26:55 pm by 173 »

 

Offline Nico

  • Venom
    Parlez-vous Model Magician?
  • 212
Quote
Originally posted by Mr. Fury
Right, but code defines how much room there is for visuality.
I don't know if it currently supports transparency and more fancy effects?

Activated by afterburners only.


just look at the pics, they're transparent.
SCREW CANON!

 

Offline Zarax

  • 210
Wow, they're pretty cool...
I think that they would be better if they looks like the ones in the DVD version, similar to homeworld's ones.
Are trails generated by the engine alone or do they require POF modifications for every ship?
The Best is Yet to Come

 

Offline Fury

  • The Curmudgeon
  • 213
Quote
Originally posted by venom2506


just look at the pics, they're transparent.


OK, whatever. :p