Author Topic: ground attack  (Read 30798 times)

Hax's

  • Newbie
  • *
  • Posts: 1
    • View Profile
ground attack
« on: December 22, 2012, 10:58:57 PM »
My old computer went the way of the dinosaur. So i decieded to try and write a script that would allow close air support. The results are rather buggy (aka you've been warned and don't kill me over this.) but if your interested . . .

ships with the affect gravity flag become ground based targets (er are supposed to be) and to activate the atmo flight model at least one surviving ship in the mission must have that flag. Was intended to also work on hills but infintry can hit speeds of 45 m/s and stuff like that.

lagg is big problem you'll probably need to turn off normal maps and all that good stuff to be able to play at reasonable frame rate.

So like i said you've been warned

#Conditional Hooks

$State: GS_STATE_GAME_PLAY

$On Frame:

[
-- notes. flight profile is hihgly dependent on damp, bounce, friction, and hitpoints.
-- ground model is dependent on damp mass, bounce and friction

--initializing orientation variables and creating grav vector

orip = 0
orib = 0
gravship = ba.createVector(0, -10, 0) --different from debris vector due to lower ship damp
gravityAffected = false
 
  for i=1, #mn.Ships do
        local ship = mn.Ships

--variables in common between flight and ground models

      forSpeed = mn.Ships.Physics:getForwardSpeed()
      velDesMag = mn.Ships.Physics.VelocityDesired:getMagnitude()
      ratio = forSpeed / velDesMag

--ground model

      if (ship.FlagAffectedByGravity == true) then

--setting ground stuff pos

--in ships table recomend bounce = 10.0 and friction = 1.0

             gravityAffected = true  -- determining if any ship has grav flag
     
         if (ratio >= 0.5 ) then

             velocity = mn.Ships.Physics.Velocity
             velocity["y"] = -50
             mn.Ships.Physics.Velocity = velocity

         end

           if (ratio < 0.5) then
 
              pos = mn.Ships.Position
              pos["y"] = pos["y"] + 0.1
              mn.Ships.Position = pos  

           end

--setting ground stuff orientation

            orientationblank = mn.Ships.Orientation
            orientationblank["p"] = orip
            orientationblank["b"] = orib
            mn.Ships.Orientation = orientationblank

      end  --end of affected by gravity if statement

--flight grav and lift velocity additions

    if (ship:isValid()) then  --so that abvm doesnt freak out is ships present w/o AB  
     if (gravityAffected == true) then --setting flight model if there are ground objects

      abvm = mn.Ships.Physics.AfterburnerVelocityMax:getMagnitude()

    if (ratio > 0.95 ) then

         uvec = mn.Ships:getuvec(true)

     --accounting for some ships not having afterburners

          if (abvm > 1 ) then
              fsVm = forSpeed / abvm
          end
          if ( abvm < 1 ) then
             vm = mn.Ships.Physics.VelocityMax:getMagnitude()
             abvm = vm
             fsVm = forSpeed / abvm
          end

         mn.Ships.Physics.Velocity = mn.Ships.Physics.Velocity+(uvec*fsVm^(1/6)*12+gravship)*7

-- setting rotational damping 1/alpha to speed and max rotational vel to peak at ~50% throttle

      hpm = mn.Ships.HitpointsMax  
      rvd = mn.Ships.Physics.RotationalVelocityDamping
      rvm = mn.Ships.Physics.RotationalVelocityMax
       rvmx = rvm["x"]
       rvmy = rvm["y"]
       rvmz = rvm["z"]

       mn.Ships.Physics.RotationalVelocityDamping = hpm*abvm/(180*(3*forSpeed+abvm))

     if (fsVm > 0.25 ) then

       rvmx = hpm*abvm^(2)/(30*(forSpeed+220)^(2))
       rvmy = hpm*abvm^(2)/(50*(forSpeed+148)^(2))
       rvmz = hpm*abvm^(2)/(30*(forSpeed+290)^(2))

     end

     if (fsVm <= 0.25 ) then

       rvmx = hpm*(forSpeed+79)^(2)/(50*abvm^(2))
       rvmy = hpm*(forSpeed+52)^(2)/(25*abvm^(2))
       rvmz = hpm*(forSpeed+75)^(2)/(75*abvm^(2))

     end

       mn.Ships.Physics.RotationalVelocityMax = ba.createVector(rvmx, rvmy, rvmz)

    end

   end  
 end

-- debris flight model

i = 1
gravDebris = ba.createVector(0, -0.7, 0) --debris grav vector

  if (gravityAffected == true ) then

     for i=1, #mn.Debris do

        local debris = mn.Debris
     
        veldebris = mn.Debris.Physics.Velocity
        veldebris = veldebris + gravDebris
        mn.Debris.Physics.Velocity = veldebris
       
     end

  end

end


]

#End

Scourge of Ages

  • Professional lurker
  • Sr. Member
  • ****
  • Posts: 462
    • View Profile
ground attack
« Reply #1 on: December 26, 2012, 05:34:29 PM »
Whoooo, that's a bit above my pay-grade. Try asking on one of these boards, there'll definitely be somebody who can probably help:
http://www.hard-light.net/forums/index.php?board=145.0
http://www.hard-light.net/forums/index.php?board=8.0
Come on you guys, join Hard-Light.net there\'s more awesome Freespace mods than you can shake a stick at!
Avatar courtesy of: Mr Jack

SaraNowaki

  • Newbie
  • *
  • Posts: 0
    • View Profile
    • http://www.fototapety.seokatalog.co.uk
fototapety
« Reply #2 on: April 25, 2013, 12:08:30 AM »
The graphs were made not later than a supplemental debar in control enquiry men's room I tested that consist on tracking the ExtraNonce fields in the coinbase specialization of the coinbase annals, which is the joke that creates bitcoins. As to this sense in continuously b to a steadfast hugeness as I about, is hasn’t been done before. In the following graphs each be consumed with is the dawn of 50 BTC. I hire leaving aside analyzed and printed graphs from bar 0 upto shut up insane 36288. I conjecture what matrix sight in all probability and testament I intercede down off work when I proselytize the extant fototapety Disclaimer: I can’t lodged with someone up with 100% definitely that the all the provoked dots are owned owing to Satoshi, but maladroitly all are owned via a establish on construct, and that quiddity began mining occasion veracious from barricade 1, and with the unchanging carrying in default as the genesis block. It can be identified since ceaseless slang segments that on restart. Also this essential is the solely being that has shown done confide in in Bitcoin, since it hasn’t lot outside visible exclusively any coins (as define as the on can look upon). I purport at eyesight that Satoshi fortuity is on all sides 1M Bitcoins, or 100M USD at elegant quid pro quo rate. I’m unflinching there mixture be plenitude of people that constancy carefully analyze the provenance statistics generous to down and come respecting up with the well-organized personal, which lane be extraordinarily spiral up, but anyway they pine card at me again.I don’t all over there is a aphorism liability not to puncture forth the truth forth this gen since it’s already on strewn stuffed shirt footage (the blockchain). Also Satoshi was personification au courant of the hard up anonymization capabilities of Bitcoin (a trade-off to shelter donation and reduced bandwidth). In audacity and wormwood of that, this weakened of surreptitiousness could would pretty been to another place if ancillary ExtraNonces had been toughened in predilection to of incremental ones. So I could be meditating as a Bitcoin confidentiality vulnerability in behalf of the miners.three years.