StellarForum
May 22, 2012, 03:33:57 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Stellar Frontier has moved to the new forum and site at stellarfrontier.com!
Please make a new account there in preparation for SF 2.0 and to chat on the boards!
 
   Home   Help Search Groups Login Register  
Pages: [1]
  Send this topic  |  Print  
Author Topic: Module values and what they do.  (Read 792 times)
Weylin
Veteran Member
*****
Posts: 336

Get ambushed, die, repeat...


Email
« on: February 07, 2009, 04:03:47 AM »

Would anyone be able to post EXACTLY the different module values do? So far I got this...

FACTORY
Determines price and repair rate. *500 costs 10,000. *1000 costs 20,000 credits.
Additionally, it took 25 seconds to repair an armour3 by 50% with a value of 500, while only taking 20 seconds with 1000.

POWER
has a direct effect on "power out" doubling the parameter will also double the power out. This value has no effect on price.


I messed with them a bit and that's what I came up with, but still don't have any solid figures.
If I knew how to read the source code I probably would -looks again-

The guide by anaxis is outdated and incomplete, though it does have some helpful info.
« Last Edit: February 07, 2009, 04:06:18 AM by Weylin » Report to moderator   Logged
Weylin
Veteran Member
*****
Posts: 336

Get ambushed, die, repeat...


Email
« Reply #1 on: February 08, 2009, 01:13:51 AM »

Could someone direct me to what part of the source code interprets what is entered in the .dat and .scn files?
Report to moderator   Logged
NiteHawk
<dev></dev>
Administrator
Legendary Member
*****
Posts: 2816



WWW
« Reply #2 on: February 08, 2009, 03:41:13 PM »

Could someone direct me to what part of the source code interprets what is entered in the .dat and .scn files?


The coding really isn't commented to state what it does or doesn't do. Two functions that may help a bit:

Code:
   if (strcmp(func,"power") == 0) {
      moduleFunc = power_plant;
      SetStat(store,par[0] * power);
      //store = par[0] * power;
      nPar = 1;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
    }
    else if (strcmp(func,"fuel") == 0) {
      moduleFunc = fuel_cell;
      SetStat(store,par[0] * power);
      //store = par[0] * power;
      nPar = 1;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
    } else if (strcmp(func,"batt") == 0) {
      moduleFunc = battery;
      SetStat(store,par[0] * power);
      //store = par[0] * power;
      nPar = 1;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
    } else if (strcmp(func,"eng") == 0) {
      moduleFunc = engine;
      MultToStat(par[0],unit_thrust / g_scale);
      //par[0] *= unit_thrust / g_scale;
      nPar = 1;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
    } else if (strcmp(func,"qdrv") == 0) {
      moduleFunc = qdrv;
      MultToStat(par[0],game->lightSpeed);
      //par[0] *= game->lightSpeed;
      nPar = 2;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
    } else if (strcmp(func,"tube") == 0) {
      /************************************************/
      /* tube weapon:                                 */
      /************************************************/
      /* par:                                         */
      /* par[0]: number of frames of power in storage */
      /* par[1]: cost per frame to fire               */
      /* par[2]: number of missiles                   */
      /* par[3]: missile index                        */
      /* par[4]: mode (same as tube)                  */
      /************************************************/
      /* specPar:                                     */
      /* par[0]: angular position on bitmap           */
      /* par[1]: radial position on bitmap            */
      /* par[2]: angle of fire                        */
      /* par[3]: starting angle in firing arc         */
      /* par[4]: ending angle in firing arc           */
      /************************************************/
      moduleFunc = tube;
      workPar[0] = par[2];  /* load tube with full complement of ammo */
      nPar = 6;
      nSPar = 5;
      nWPar = 1; //check this
      checkSum = CheckSum();
      Replenish();
    } else if (strcmp(func,"beam") == 0) {
      /************************************************/
      /* beam weapon:                                 */
      /* par[0]: number of frames of power in storage */
      /* par[1]: cost per frame to fire               */
      /* par[2]: maximum range                        */
      /* par[3]: (not used)                           */
      /* par[4]: mode (same as tube)                  */
      /************************************************/
      /* specPar:                                     */
      /* par[0]: angular position on bitmap           */
      /* par[1]: radial position on bitmap            */
      /* par[2]: angle of fire (not used)             */
      /* par[3]: starting angle in firing arc         */
      /*         (not used)                           */
      /* par[4]: ending angle in firing arc           */
      /*         (not used)                           */
      /************************************************/
      moduleFunc = beam;
      nPar = 5;  //check this
      nSPar = 5; //check this
      nWPar = 2; //check this
      checkSum = CheckSum();
      Replenish();
    } else if (strcmp(func,"ram") == 0) {
      /************************************************/
      /* ram weapon:                                  */
      /* par[0]: number of frames of power in storage */
      /* par[1]: cost per frame to fire               */
      /* par[2]: number of rams                       */
      /* par[3]: missile index                        */
      /* par[4]: mode (same as tube)                  */
      /************************************************/
      /* specPar:                                     */
      /* par[0]: angular position on bitmap           */
      /* par[1]: radial position on bitmap            */
      /* par[2]: angle of fire                        */
      /* par[3]: starting angle in firing arc         */
      /*         (not used)                           */
      /* par[4]: ending angle in firing arc           */
      /*         (not used)                           */
      /************************************************/
      moduleFunc = ram;
      workPar[0] = par[2];  /* load tube with full complement of ammo */
      nPar = 5;  //check this
      nSPar = 3; //do not need firing arc
      nWPar = 1; //check this
      checkSum = CheckSum();
      Replenish();
    } else if (strcmp(func,"shield") == 0) {
      moduleFunc = shield;
      nPar = 1;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
      Replenish();
    } else if (strcmp(func,"armor") == 0) {
      moduleFunc = armor;
      nPar = 1;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
      Replenish();
    } else if (strcmp(func,"brake") == 0) {
      moduleFunc = brake;
      nPar = 1;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
    } else if (strcmp(func,"sensor") == 0) {
      moduleFunc = sensor;
      nPar = 1;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
    } else if (strcmp(func,"cm") == 0) {
      moduleFunc = counter_measures;
      nPar = 2;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
      Replenish();
    } else if (strcmp(func,"stealth") == 0) {
      moduleFunc = cloak;
      nPar = 4;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
      Replenish();
    } else if (strcmp(func,"boost") == 0) {
      moduleFunc = boost;
      nPar = 3;
      nSPar = 0;
      nWPar = 0;
      checkSum = CheckSum();
      Replenish();
    } else if (strcmp(func,"dock") == 0) {
      /************************************************/
      /* dock:                                        */
      /************************************************/
      /* par:                                         */
      /* par[0]: number of frames of power in storage */
      /* par[1]: thrust parameter (same units as      */
      /*         engine)                              */
      /* par[2]: range in pixels                      */
      /************************************************/
      /* specPar:                                     */
      /* par[0]: angular position on bitmap           */
      /* par[1]: radial position on bitmap            */
      /* par[2]: angle of docked target               */
      /************************************************/
      moduleFunc = dock;
      MultToStat(par[1],unit_thrust / g_scale);
      //par[1] *= unit_thrust / g_scale;
      nPar = 3;
      nSPar = 3;
      nWPar = 2;
      checkSum = CheckSum();
      Replenish();
    } else if (strcmp(func,"factory") == 0) {
      moduleFunc = factory;
      nPar = 1;
      nSPar = 4; /* 1: production ; 3: temporary port number assignment */
      nWPar = 2;
      checkSum = CheckSum();
    }
  }

Code:
void ModuleClass::IncreaseValue(long v, long p) {
  if ( check != 0xAAAAAAAA ) return;
  /* increase the value of the module by the amount v */

  short nf;
  long f, df, t;

  switch (moduleFunc) {

  case power_plant:
    AddToStat(power,v/1000);
    //power += v / 1000;
    break;
  case engine:
    SetStat(par[0],min(par[0] + v/1000, 100000 /* max_engine_thr */));
    //par[0] = min(par[0] + v/1000, 100000 /* max_engine_thr */);
    break;
  case qdrv:
    nf = 2;
    SetStat(par[0],min(par[0] + v/20/nf, 10*game->lightSpeed /* max_qspeed */));
    //par[0] = min(par[0] + v/20/nf, 10*game->lightSpeed /* max_qspeed */);
    SetStat(par[1],min(par[1] + v/20/nf, 100000 /* max_towable_qmass */));
    //par[1] = min(par[1] + v/20/nf, 100000 /* max_towable_qmass */);
    break;
  case tube:
    nf = 2;
    /* increase the tube burst by increasing the amount of power it */
    /* can store: par[0]                                            */
    /* increase the repeat rate by increasing the power recharge    */
    /* rate: power                                                  */
    SetStat(par[0],min(par[0] * (100 + p/nf) / 100, 100 /* max_tube_cap */));
    //par[0] = min(par[0] * (100 + p/nf) / 100, 100 /* max_tube_cap */);
    SetStat(power,-min(-power * (100 + p/nf) / 100, 50 /* max_tube_power */));
    //power = -min(-power * (100 + p/nf) / 100, 50 /* max_tube_power */);
    break;
  case shield:
    /* increase the capacity */
    nf = 2;
    f = -power * par[0];
    df = max(min(v/2000, 5000 - f /* max_shield_cap */), 0);
    if ((f + df/nf) / max(par[0],1) != -power) {
      /* try to divide it evenly */
      t = (f + df/nf) / max(-power,1);
      SetStat(power,-(f + df/nf) / max(par[0],1));
      //power = -(f + df/nf) / max(par[0],1);
      SetStat(par[0],t);
      //par[0] = t;
    } else
      /* take it all out of par[0] */
      SetStat(par[0],(f + df) / max(-power,1));
    //par[0] = (f + df) / max(-power,1);
    break;
  case brake:
    /* decrease the braking factor */
    SetStat(par[0],max(par[0] + v/5, 50 /* max_brake_factor */));
    //par[0] = max(par[0] + v/5, 50 /* max_brake_factor */);
    break;
  case sensor:
    SetStat(par[0],min(par[0] + v/20000, 100 /* max_sensor_par */));
    //par[0] = min(par[0] + v/20000, 100 /* max_sensor_par */);
    break;
  case fuel_cell:
    /* do nothing */
    break;
  case battery:
    /* do nothing */
    break;
  case counter_measures:
    SetStat(par[1],min(par[1] + v/3000, 500 /* max_cm_range */));
    par[1] = min(par[1] + v/3000, 500 /* max_cm_range */);
    break;
  case cloak:
    /* increase the capacity */
    nf = 2;
    f = -power * par[0];
    df = min(v/10, 40000 - f /* max_stealth_cap */);
    if ((f + df/nf) / max(par[0],1) != -power) {
      /* try to divide it evenly */
      t = (f + df/nf) / max(-power,1);
      SetStat(power,-(f + df/nf) / max(par[0],1));
      //power = -(f + df/nf) / max(par[0],1);
      SetStat(par[0],t);
      //par[0] = t;
    } else
      /* take it all out of par[0] */
      SetStat(par[0],(f + df) / max(-power,1));
    //par[0] = (f + df) / max(-power,1);
    break;
  case boost:
    /* increase the capacity first, then maxSpeed and acceleration */
    nf = 4;
    f = -power * par[0];
    df = min(v / max(par[1]*par[2]/100,1), 500000 - f /* max_boost_cap */);
    t = (f + df/nf) / max(-power,1);
    SetStat(power,-(f + df/nf) / max(par[0],1));
    //power = -(f + df/nf) / max(par[0],1);
    SetStat(par[0],t);
    //par[0] = t;
    /* now adjust maxSpeed and accel */
    SetStat(par[1],min(par[1] * (100 + p/nf)/100, 300 /* max_boost_vpct */));
    //par[1] = min(par[1] * (100 + p/nf)/100, 300 /* max_boost_vpct */);
    SetStat(par[2],min(par[2] * (100 + p/nf)/100, 80 /* max_boost_apct */));
    //par[2] = min(par[2] * (100 + p/nf)/100, 80 /* max_boost_apct */);
    break;
  case dock:
    /* increase the tractor capacity first, then range and strength */
    nf = 4;
    f = -power * par[0];
    df = min(v / max(par[1]*par[2]/50000,1), 100000 - f /* max_dock_cap */);
    t = (f + df/nf) / max(-power,1);
    SetStat(power,-(f + df/nf) / max(par[0],1));
    //power = -(f + df/nf) / max(par[0],1);
    SetStat(par[0],t);
    //par[0] = t;
    /* now adjust maxSpeed and accel */
    SetStat(par[1],min(par[1] * (100 + p/nf)/100,
5000*unit_thrust/g_scale /* max_tractor_thr */));
    //par[1] = min(par[1] * (100 + p/nf)/100,
    // 5000*unit_thrust/g_scale /* max_tractor_thr */);
    SetStat(par[2],min(par[2] * (100 + p/nf)/100, 400 /* max_tractor_range */));
    //par[2] = min(par[2] * (100 + p/nf)/100, 400 /* max_tractor_range */);
    break;
  case factory:
    /* do nothing */
    break;
  case armor:
    /* do nothing */
    break;
  }

The kick in the face is that most of it isn't actually specified. You'd have to research 'factory' for example and see what it does, if it doesn't have a comment.

par[0], par[1], par[2] etc refers to the numbers like factory*par0*par1, get me?

Otherwise the coding is rather messy. You'd have to find out what the pars do actually in the coding.

But its all in trek.cpp, trek.h, the two biggest, messest files. I really need to sum them down and split them up  Roll Eyes

p.s. battery is the same as fuel, which is basicly power without a recharge, you can even fit these on ships, but if they run out you explode.. :p
« Last Edit: February 08, 2009, 03:42:54 PM by NiteHawk » Report to moderator   Logged

http://chrisvall.com - Coding/gaming blog in the works.
Weylin
Veteran Member
*****
Posts: 336

Get ambushed, die, repeat...


Email
« Reply #3 on: February 08, 2009, 08:25:56 PM »

the par[number] are an... array? is that what they call them? like putting an index on a variable so you can have more control over how there read or somthing, i forget.

you're right though, that code isn't very understandable, though if I look at it for a while I guess I'll figure it out. But ill have to figure out what each variable is supposed to even do, and since they have rather uninformative names it will take a while...


EDIT: lol appearently [ # ] turns into
Report to moderator   Logged
NiteHawk
<dev></dev>
Administrator
Legendary Member
*****
Posts: 2816



WWW
« Reply #4 on: February 09, 2009, 04:11:30 AM »

Yeah there called arrays Tongue And it's more or less more clean so you don't have to use multiple variables. Basicly like a index of variables, yes.

So it does like for example for cloak (Something I've tampered with so I know them. I added the par[2] and par[3] for uncloak/cloaking times):

par[0] = capacity/length of cloak.
par[1] = frames at which cloaks turns off (It's wierd, doesn't have much affect. Maximum always defaults at 1000, but you can set it higher to give it a higher cost, which I've done to 'phase' for now until I fix the credits. Basicly if theres '800 fps left' in the cloak, it shuts down.. This is more or less about the amount left of the bar when it hits 0. or looks like it, rather.. It's a mess.)
par[2] = Time to uncloak
par[3] = Time to cloak

As you see here, now when I call something I do a check to see normally what the module is, then I run through the parms, so if I need the uncloak time, I call par[2] .. So like

      if (bus.stealthMod && !bus.stealthMod->IsActive() && stealthLevel)
      if (frame % bus.stealthMod->par[2] == 0)
      stealthLevel--;

If you see here... bus.stealthMod means "If I have stealth", IsActive is basicly what it states, if its on, and stealthLevel, well theres 7 of these, its basicly the TRANSISTION of the cloak. (7 of them until your fully 'cloaked')

And for example, if we plug in bus.stealthMod->par[2] = 3, then every 3 frames you will start cloaking (seeing a transisition of the 7 stealthLevels.)

Kinda get me on that? I know it's kinda rough, I've had a couple months to play with it but eh, documentation is rough unless you tackle it by looking at it and finding the par values. :\
Report to moderator   Logged

http://chrisvall.com - Coding/gaming blog in the works.
Pages: [1]
  Send this topic  |  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!