Author Topic: fighter beams  (Read 35207 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 the first majore thing I, and many here are fighter beams, to this end I have looked and found the code dealing with the targetting laser and found the bug that makes it only fire only from the first weapon point,
I made the following change to the function

Code: [Select]

void ship_process_targeting_lasers()
{
ship *shipp;
beam_fire_info fire_info;
ship_obj *so;
polymodel *m;
polymodel *po = model_get( Ship_info[shipp->ship_info_index].modelnum );
int num_slots = po->gun_banks[shipp->targeting_laser_bank].num_slots;

// interate over all ships
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
// sanity checks
if(so->objnum < 0){
continue;
}
if(Objects[so->objnum].type != OBJ_SHIP){
continue;
}
if(Objects[so->objnum].instance < 0){
continue;
}
shipp = &Ships[Objects[so->objnum].instance];

// if our trigger is no longer down, switch it off
if(!(shipp->flags & SF_TRIGGER_DOWN)){
ship_stop_targeting_laser(shipp);
continue;
}

// if we have a bank to fire - fire it
if((shipp->targeting_laser_bank >= 0) && (shipp->targeting_laser_bank < 2)){
// try and get the model
m = model_get(shipp->modelnum);
if(m == NULL){
continue;
}

// fire a targeting laser
for ( int j = 0; j < num_slots; j++ ){
fire_info.accuracy = 0.0f;
fire_info.beam_info_index = shipp->weapons.primary_bank_weapons[shipp->targeting_laser_bank];
fire_info.beam_info_override = NULL;
fire_info.shooter = &Objects[shipp->objnum];
fire_info.target = NULL;
fire_info.target_subsys = NULL;
fire_info.turret = NULL;
fire_info.targeting_laser_offset = m->gun_banks[shipp->targeting_laser_bank].pnt[j];
shipp->targeting_laser_objnum = beam_fire_targeting(&fire_info);

// hmm, why didn't it fire?
if(shipp->targeting_laser_objnum < 0){
Int3();
ship_stop_targeting_laser(shipp);
}
}
}
}
}


when I compiled the ship.cpp, I got a warning about the shipp  not being properly initalised, I'm building with these changes now, but it takes two hours before I'll know if it works, and I don't realy know what I'm doing
anyone who does know what there doing know if I broke something and tell me how to fix it, or want to do it your self

this seems to the line it doesn't like, I don't know what it means  not initalised
   polymodel *po = model_get( Ship_info[shipp->ship_info_index].modelnum );
« Last Edit: April 27, 2002, 10:45:47 pm by 57 »
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 daveb

  • WHEE!!
  • 25
Er. That's uh, some pretty incorrect code. You're referencing some data from a random point in memory. That'll crash every time. You're gonna want to move that polymodel_get() inside the loop past where shipp gets setup. You're also ignoring a potential -1 for shipp->targeting_laser_bank.

But aside from all that - beams on fighters is a harder problem than you might expect. A lot of the beam code expects to be able to find turret subsystems on ships that are firing beams. What this basically amounts to is crashy crashy for most non-cap ships. If memory serves me right it works ok on bombers because some of them have turrets.

I think what you need to realize is that there is no 2-line fix for about 99% of the "wishlist" features people have been proposing (not just this specific case). Most significant changes to systems require a lot of work. If you don't do this and you just plow ahead you're going to end up with a pile of randomly crashing unmaintainable code. Even in a non-official version that's going to be unacceptable for most people. That's the perspective from the view of the grizzled game programmer, anyway.
« Last Edit: April 27, 2002, 11:11:41 pm by 700 »

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
well I saw there was an offset, and I saw in the code it just referenced one firing point, I figured if I just told it to fire a beam from for each firing point from each firing point it might work
well I'm an idiot who has no Idea what he is doing :)
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 Setekh

  • Jar of Clay
  • 215
    • Hard Light Productions
Quote
Originally posted by daveb
I think what you need to realize is that there is no 2-line fix for about 99% of the "wishlist" features people have been proposing (not just this specific case). Most significant changes to systems require a lot of work. If you don't do this and you just plow ahead you're going to end up with a pile of randomly crashing unmaintainable code. Even in a non-official version that's going to be unacceptable for most people. That's the perspective from the view of the grizzled game programmer, anyway.


Momentarily discouraging but realistic. I guess this is all us non-programming plebs will be able to meddle with for now. Who knows, we might all end up learning some of this by just playing around with the source: just like the other features of FS modding. Perhaps I should have taken that programming course last year after all. :D
- Eddie Kent Woo, Setekh, Steak (of Steaks), AWACS. Seriously, just pick one.
HARD LIGHT PRODUCTIONS, now V3.0. Bringing Modders Together since January 2001.
THE HARD LIGHT ARRAY. Always makes you say wow.

 

Offline daveb

  • WHEE!!
  • 25
Most definitely. A big part of being able to make serious changes to the code is being familiar with it first. When we hire a new guy, he doesn't show up on day one and start writing rendering code :)  Most fresh-off-the-street rookies start out with something hard to screw up, like interface code or something like that. This goes triple if he's coming into a project that's already well in progress.

The same sort of thing applies here. Its tempting to make quick changes that may appear to work at first. But because lots of code is interdependant you may cause a really obscure crash or some odd behavior down the road. And you guys don't have the "luxury" of having everyone in one building and being able to run around and debug stuff when its broken.

The bottom line is, if you want to do something cool, pick _one_ thing and be prepared to spend a week or more on it (or, for lots of the graphics stuff people seem to want - months). _Then_ you'll see progress and you won't be disheartened.

 

Offline mikhael

  • Back to skool
  • 211
  • Fnord!
    • http://www.google.com/search?q=404error.com
Quote
Originally posted by daveb
The bottom line is, if you want to do something cool, pick _one_ thing and be prepared to spend a week or more on it (or, for lots of the graphics stuff people seem to want - months). _Then_ you'll see progress and you won't be disheartened.


Or, for that Python scripting host to replace SEXPs that I want, YEARS. ;)
[I am not really here. This post is entirely a figment of your imagination.]

 

Offline daveb

  • WHEE!!
  • 25
Yeah, that'd be an interesting one :)

 

Offline Setekh

  • Jar of Clay
  • 215
    • Hard Light Productions
Quote
Originally posted by mikhael
Or, for that Python scripting host to replace SEXPs that I want, YEARS. ;)


Hah! Python rocks! :)

Thanks for the words, Dave. Remind me again how long you've been coding?
- Eddie Kent Woo, Setekh, Steak (of Steaks), AWACS. Seriously, just pick one.
HARD LIGHT PRODUCTIONS, now V3.0. Bringing Modders Together since January 2001.
THE HARD LIGHT ARRAY. Always makes you say wow.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
I wasn't expecting to get it to work, just playing around for my own amusement, maybe I'd get lucky and it'd work, more likely it would crash in some horable way, was hopeing to get the attention of someone who knows what they are doing and they'd get it working, or have some discusion on th subject
I'm actually kind of embarrassed that you saw my pseudo-code, I'm sure you got a good chuckle out of it :)
this code is just so well organised, logical, and well documented, it made it seem easier than it realy is
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 daveb

  • WHEE!!
  • 25
Quote
this code is just so well organised, logical, and well documented, it made it seem easier than it realy is


I'm not entirely sure I agree with that. There's some pretty horrifying stuff in the FS2 codebase.

 

Offline Setekh

  • Jar of Clay
  • 215
    • Hard Light Productions
Quote
Originally posted by Bobboau
I'm actually kind of embarrassed that you saw my pseudo-code, I'm sure you got a good chuckle out of it :)
this code is just so well organised, logical, and well documented, it made it seem easier than it realy is


Heheh, I know what that's like... I was once playing around with one of my brother's Python scripts which synchronises his bookmarks for him back home and at work. I thought it was pretty cool, so I started to do a pseudo-code design for a similar script that would instead update my backups off our database here at HLP... when my brother got home and read it, he burst out laughing. :D

And yes, that's true. It's kinda elegant... well, it is to me, anyway. ;)
- Eddie Kent Woo, Setekh, Steak (of Steaks), AWACS. Seriously, just pick one.
HARD LIGHT PRODUCTIONS, now V3.0. Bringing Modders Together since January 2001.
THE HARD LIGHT ARRAY. Always makes you say wow.

 

Offline Red5

  • 27
    • http://www.roughnecks.org
what does this daveb know he has only posted 10 times, newby...

Just Kidding Dave... Hey remember how you said you wanted to make a Freespace RTS...your dreams becoming reality!!
http://www.hard-light.net/forums/index.php/topic,7194.0.html
This is my signature

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
ok so if I move the
Code: [Select]

shipp = &Ships[Objects[so->objnum].instance];
polymodel *po = model_get( Ship_info[shipp->ship_info_index].modelnum );
int num_slots = po->gun_banks[shipp->targeting_laser_bank].num_slots;



bit into the loop it won't crash ?

makes sense with that
so = GET_FIRST(&Ship_obj_list)
bit there

.. eh, I probly should just read more of this before I screw it up

am I totaly clueless, and should just give up on this now :)
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
Quote
Originally posted by daveb

I think what you need to realize is that there is no 2-line fix for about 99% of the "wishlist" features people have been proposing (not just this specific case). Most significant changes to systems require a lot of work. If you don't do this and you just plow ahead you're going to end up with a pile of randomly crashing unmaintainable code. Even in a non-official version that's going to be unacceptable for most people. That's the perspective from the view of the grizzled game programmer, anyway.


That's what I have tried to told most of you non-programmers since the source was released... :doubt:

Sup all! 4r3 joo r34dy 2 l34rn 411 4b0u7 7h15 5k1ll? Wh3n u r d0n3, joo w111 PWN 7h15 5k1ll!!!

:headz: I need to grab that MS Visul c++ enterprise edition somewhere...

 

Offline Carl

  • Render artist
  • 211
    • http://www.3dap.com/hlp/
i never said it was gonna be easy, just that you have no choice :D
"Gunnery control, fry that ****er!" - nuclear1

 

Offline Shrike

  • Postadmin
  • 211
    • http://www.3dap.com/hlp
Hope you, uh, like the new title there Dave.  :D :v:
WE ARE HARD LIGHT PRODUCTIONS. YOU WILL LOWER YOUR FIREWALLS AND SURRENDER YOUR KEYBOARDS. WE WILL ADD YOUR INTELLECTUAL AND VERNACULAR DISTINCTIVENESS TO OUR OWN. YOUR FORUMS WILL ADAPT TO SERVICE US. RESISTANCE IS FUTILE.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
hey, he's a V god again

couldn't you have thought up a more origonal title

hey wait a second, you just derailed this thread
quit it!!!
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 Setekh

  • Jar of Clay
  • 215
    • Hard Light Productions
Quote
Originally posted by Shrike
Hope you, uh, like the new title there Dave.  :D :v:


And the nice image you got there. ;)
- Eddie Kent Woo, Setekh, Steak (of Steaks), AWACS. Seriously, just pick one.
HARD LIGHT PRODUCTIONS, now V3.0. Bringing Modders Together since January 2001.
THE HARD LIGHT ARRAY. Always makes you say wow.

 

Offline DTP

  • ImPortant Coder
  • 28
    • http://www.c4-group.dk
Naaa, I’m not as clueless "I think", but once I was. I Screwed a lot when I fumbled around with the Q2 code and the LCC-32 bit compiler. No luxury of a debug utility here.

I totally understand why ppl are using MS dev C++ or Borland cause it just don’t crashes, at actually gives you the reason, when you are doing debug builds. Pretty neat.

There is still stuff I don’t understand, and still stuff I use that I don’t understand fully either, but unless I don’t use it, I will never learn what I’m doing wrong.

Let me Quote from the creator of c++; Bjarne Stoustrup, book.

THE C++ programming LANGUAGE
Third edition
Page 43

You don’t have to know every detail of c++ to write good programs.

And

Page 20 chapter 2

"The first thing we do, lets kill all the language lawyers"
-henry VI, part III

You make of this what you like.

i can recommend this book, at first i thought bogus, but what i had then was an outdated compiler. MS VS 5.0

Using namespace std:: crap :)

so if any are interested in this book, it published by Addison Wesley

Even beginners can start with this book, and even professionals can learn new things from it too, at least they claim that.

Title

"The C++ programming Language"
Author Bjarne Stroustrup
ISBN 0-201-889543
$44.95 (“when I got it”)
VBB member; reg aug 1999; total posts 600.
War is a lion, on whos back you fall, never to get up.
Think big. Invade Space.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
I'll take a look at that

and

HOLY **** IT WORKED!!!!1!!!111

the targetting beam now comes out of all weapon slots and uses energy!!!

I can't beleve it worked :jaw:
I am SO happy and exited
I'll do a little more testing then I'll post the EXE, and the new function def, actualy I'll post the def right now
Code: [Select]

void ship_process_targeting_lasers()
{
beam_fire_info fire_info;
ship_obj *so;
ship *shipp;
polymodel *m;

// interate over all ships
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
// sanity checks

shipp = &Ships[Objects[so->objnum].instance];
polymodel *po = model_get( Ship_info[shipp->ship_info_index].modelnum );
int num_slots = po->gun_banks[shipp->targeting_laser_bank].num_slots;

if(so->objnum < 0){
continue;
}
if(Objects[so->objnum].type != OBJ_SHIP){
continue;
}
if(Objects[so->objnum].instance < 0){
continue;
}

// if our trigger is no longer down, switch it off
if(!(shipp->flags & SF_TRIGGER_DOWN)){
ship_stop_targeting_laser(shipp);
continue;
}

// if we have a bank to fire - fire it
if((shipp->targeting_laser_bank >= 0) && (shipp->targeting_laser_bank < 2)){
// try and get the model
m = model_get(shipp->modelnum);
if(m == NULL){
continue;
}

// fire a targeting laser
for ( int j = 0; j < num_slots; j++ ){
fire_info.accuracy = 0.0f;
fire_info.beam_info_index = shipp->weapons.primary_bank_weapons[shipp->targeting_laser_bank];
fire_info.beam_info_override = NULL;
fire_info.shooter = &Objects[shipp->objnum];
fire_info.target = NULL;
fire_info.target_subsys = NULL;
fire_info.turret = NULL;
fire_info.targeting_laser_offset = m->gun_banks[shipp->targeting_laser_bank].pnt[j];
shipp->targeting_laser_objnum = beam_fire_targeting(&fire_info);

// hmm, why didn't it fire?
if(shipp->targeting_laser_objnum < 0){
Int3();
ship_stop_targeting_laser(shipp);
}
}
}
}
}



that goes into the ship.cpp

can someone with pro edition compile that in relese build, please
with upped tbl limets if you can

:D:D:D:D
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