[LIB] get bullet speeds

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
Gazz
Posts: 12430
Joined: Fri, 13. Jan 06, 17:39
x3tc

[LIB] get bullet speeds

Post by Gazz » Sat, 10. May 08, 16:21

This library script is a stepping stone for a script I'm currently working on.

Call it without arguments. (the arguments serve internal purposes)

It returns:
  • a 2 dimensional Array.
  • Sub-Array 0: List of all lasers that can be used by ships that currently exist in the universe.
    If no existing ship at all can use a laser (such as the repair laser or terran lasers when there are no terrans) then this laser is not included.

    If a laser does no shield or hull damage it is not included.

    That array alone could be useful in some cases.

    If you wish to include weird lasers, temporarily create a ship (argon race) before running this script.
  • Sub-Array 1: List of associated bullet speeds in m/s
Notes:
  • This script takes up to 25 sec to complete and can appear to lock up X3 for several seconds.
    It does some heavy number crunching but I didn't find a better way to filter out invalid lasers that no ship can use...
    Good thing it only needs to run once. =)
    Just don't run it directly from a setup script...
  • You know that exact timing is very tricky in X3 so these are not exact values.
    How exact the speeds are depends on the current FPS... and a little luck. =)
  • Super fast bullets (Vanilla Khaak beams do 6000 - 12000 m/s) can not be measured.
    The highest I ever got from those was in the 3000 range. They simply travel too fast within 1 frame.
  • Flak is special...
    Even through the bullet is super fast, the actual damage is created later by the secondary explosion.
    That delay results in measured speeds in the 500-1200 range.
  • And because someone is going to ask:
    This script doesn't contain a single hardcoded value. It's the good stuff.
  • There might still be a few rough edges. I'll find out when I actually use it. =)
Image (ZIP)

That is how the X3 Vanilla values look. I only edited/sorted the laser names for readability.

Code: Select all

Spd:  437,  Laser:        Concussion Impulse Generator
Spd:  533,  Laser:  Alpha Flak Artillery Array
Spd: 1250,  Laser:  Beta  Flak Artillery Array
Spd:  301,  Laser:  Alpha High Energy Plasma Thrower
Spd:  261,  Laser:  Beta  High Energy Plasma Thrower
Spd:  519,  Laser:  Alpha Impulse Ray Emitter
Spd:  503,  Laser:  Beta  Impulse Ray Emitter
Spd:  781,  Laser:        Ion Disruptor
Spd: 1511,  Laser:  Alpha Kyon Emitter
Spd: 1429,  Laser:  Beta  Kyon Emitter
Spd: 2951,  Laser:  Gamma Kyon Emitter
Spd: 2945,  Laser:        Lasertower Weapon
Spd:  408,  Laser:        Mass Driver
Spd:  448,  Laser:  Alpha Particle Accelerator Cannon
Spd:  392,  Laser:  Beta  Particle Accelerator Cannon
Spd:  286,  Laser:  Alpha Phased Shockwave Generator
Spd:  247,  Laser:  Beta  Phased Shockwave Generator
Spd:  250,  Laser:  Gamma Phased Shockwave Generator
Spd:  267,  Laser:  Alpha Photon Pulse Cannon
Spd:  226,  Laser:  Beta  Photon Pulse Cannon
Spd:  234,  Laser:  Gamma Photon Pulse Cannon
Spd:  635,  Laser:  Alpha Pulsed Beam Emitter
Spd:  700,  Laser:  Beta  Pulsed Beam Emitter
Last edited by Gazz on Mon, 19. May 08, 19:28, edited 2 times in total.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Tue, 13. May 08, 03:28

Out of curiosity, does your script take your ships current velocity into account? I know for a fact that it does make a difference (as my test dev mode ship flies at 1000000 or something, and it still fires rather normally -until I change direction)

User avatar
Gazz
Posts: 12430
Joined: Fri, 13. Jan 06, 17:39
x3tc

Post by Gazz » Tue, 13. May 08, 12:36

No. It tests bullets, not ships. Other variables are eliminated.
Simply add your ship's speed when needed.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

GlorfindelX
Posts: 166
Joined: Wed, 28. Dec 05, 08:36
x3ap

Post by GlorfindelX » Tue, 13. May 08, 15:43

s9ilent wrote:Out of curiosity, does your script take your ships current velocity into account? I know for a fact that it does make a difference (as my test dev mode ship flies at 1000000 or something, and it still fires rather normally -until I change direction)
What happens when you change directions while firing?

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Tue, 13. May 08, 23:25

If im traveling in a stralight line at 100 and I fire a bullet at 2000, from a fixed stationary observer, the bullet is traveling at 2100 (2000+100). Where as from my point of view its traveling at 100.

If i change direction, then it will be going somewhere from 100-2100 (depending on which direction i'm facing, where exactly backwards is 2100, sideways is 2000 and so on and so forth)

i.e. Bullets have add your initial velocity to theirs.

Post Reply

Return to “X³: Reunion - Scripts and Modding”