Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Railgun.oxp v 1.3 now available

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

User avatar
CommonSenseOTB
---- E L I T E ----
---- E L I T E ----
Posts: 1397
Joined: Wed May 04, 2011 10:42 am
Location: Saskatchewan, Canada

Re: ??Rail Gun??

Post by CommonSenseOTB »

Fear not - I temporarily swapped Katana for Moderator's magic wand
Alex wrote:
Wasn't sure where to post this"
Is this a joke?

The best place for posting bugs, comments, and test results of an oxp is in the thread that the oxp author originally started when he released it. It would be in Expansion Pack Forum. Simple enough to do a search for title names.

-------------------------------------------------------------------------------------------------------
<The following may be harsh but there is a point to be made here. Parental guidance is advised.>
-------------------------------------------------------------------------------------------------------


If you have a problem with an oxp, do you want to hunt through 100+ different threads just to find one relevant sentence? Most people at least do a search first before asking a question. If you did then you no doubt found the railgun thread in expansion pack forum. Why then did you not post it there? Because you never even did a search, that's why. You've been a member of this board since 2008 with so many posts under your belt and you don't know how to do a search?

Flip this around for a second from your life that's too busy for 10 seconds of searching.

If you were an oxp author, where would you want all questions, bugs, comments and test results of that oxp. Try a different view. If you were someone else who was interested in an oxp and what was happening with it would you want to chase all over just to find relevant information concerning it and what is currently being discussed in that oxp's thread. Try a different view. You are doing research on any subject and use a keyword for your search. Anything labelled in a way different from your search word(s) will NOT be shown. You would not want to have to type in 20 different search words just to not find all/nearly all relevant posts. And searching by the word itself instead of the title doesn't help much. Do you know how many posts you have to go through when you type in a word for a general search? 100's to 1000's. Do you really want to search through all those?

Put yourself in another person's shoes for a minute. Make their life easier. Do a search before posting a new thread. With 1000's of topics names that have already been posted there is a good chance 1 of them will fit what you want to post about.

I know you know how to do a search because you could NOT have found oolite without searching for it.

----------------------------------------------------------------------------------------------------
<The preceding was harsh but there was a point to be made here. You may now open your eyes.>
-----------------------------------------------------------------------------------------------------

I must apologize Alex but I wanted to make a point here and this seemed like a good way to do it. I hold nothing against you personally. This is the most obvious example to come along so I took the opportunity. There are many members who make scores of duplicate threads about exactly the same thing choking up the board and sucking the spare time of everyone just to sift through them both now and in the future when it comes time to look up a reference. Information is useless if you can't find it when you need it. For the sake of oolite and for the love of all that is holy please stop making duplicate threads.

Man that felt good! :D
Last edited by DaddyHoggy on Wed Jul 13, 2011 6:55 pm, edited 1 time in total.
Reason: In response to "wrong thread" response from CSOTB
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.


CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
User avatar
Alex
---- E L I T E ----
---- E L I T E ----
Posts: 770
Joined: Mon Oct 06, 2008 10:49 pm
Location: Oz. The land of some gold but mostly rust

Re: ??Rail Gun??

Post by Alex »

CommonSenseOTB wrote:
Alex wrote:
Wasn't sure where to post this"
Is this a joke?

The best place for posting bugs, comments, and test results of an oxp is in the thread that the oxp author originally started when he released it. It would be in Expansion Pack Forum. Simple enough to do a search for title names.

-------------------------------------------------------------------------------------------------------
<The following may be harsh but there is a point to be made here. Parental guidance is advised.>
-------------------------------------------------------------------------------------------------------


If you have a problem with an oxp, do you want to hunt through 100+ different threads just to find one relevant sentence? Most people at least do a search first before asking a question. If you did then you no doubt found the railgun thread in expansion pack forum. Why then did you not post it there? Because you never even did a search, that's why. You've been a member of this board since 2008 with so many posts under your belt and you don't know how to do a search?

Flip this around for a second from your life that's too busy for 10 seconds of searching.

If you were an oxp author, where would you want all questions, bugs, comments and test results of that oxp. Try a different view. If you were someone else who was interested in an oxp and what was happening with it would you want to chase all over just to find relevant information concerning it and what is currently being discussed in that oxp's thread. Try a different view. You are doing research on any subject and use a keyword for your search. Anything labelled in a way different from your search word(s) will NOT be shown. You would not want to have to type in 20 different search words just to not find all/nearly all relevant posts. And searching by the word itself instead of the title doesn't help much. Do you know how many posts you have to go through when you type in a word for a general search? 100's to 1000's. Do you really want to search through all those?

Put yourself in another person's shoes for a minute. Make their life easier. Do a search before posting a new thread. With 1000's of topics names that have already been posted there is a good chance 1 of them will fit what you want to post about.

I know you know how to do a search because you could NOT have found oolite without searching for it.

----------------------------------------------------------------------------------------------------
<The preceding was harsh but there was a point to be made here. You may now open your eyes.>
-----------------------------------------------------------------------------------------------------

I must apologize Alex but I wanted to make a point here and this seemed like a good way to do it. I hold nothing against you personally. This is the most obvious example to come along so I took the opportunity. There are many members who make scores of duplicate threads about exactly the same thing choking up the board and sucking the spare time of everyone just to sift through them both now and in the future when it comes time to look up a reference. Information is useless if you can't find it when you need it. For the sake of oolite and for the love of all that is holy please stop making duplicate threads.

Man that felt good! :D
Ye, Right, My skin is thicker that, so no harm done, no offense taken.
I did do search's before the post. Just under half an hours worth, but didn't find what I was looking for. Thought it would be quicker and easier to post off the main chat channel.
And What do you know. Got the answers I was looking for.
Way to go Oolite BB. :D
LOOK OUT!!!
OOPS..
"Press Space" Commander
If you do not see "Press Space" more often than you want.. Your not trying!
User avatar
Alex
---- E L I T E ----
---- E L I T E ----
Posts: 770
Joined: Mon Oct 06, 2008 10:49 pm
Location: Oz. The land of some gold but mostly rust

Re: ??Rail Gun??

Post by Alex »

Commander McLane wrote:
Well, the Railgun is not designed to be an über-weapon.

I just tried with a standard Cobra at about 7000 meters, and with NPC-shields installed. It took me a total of 24 projectiles to kill it. Six or seven were needed just to take the shields down, so without NPC-shields I probably could have done it with 18 projectiles.

Note that the railgun is a kinetic weapon. It is far more effective against an approaching target than against a stationary target. Best effect is if you fly at top speed and hit a ship that's flying head-on against you at top speed.

As for the resell value: all numbers you see on the F3-screen are prices. A price is generally what you pay, not what you get. In other words, you have to pay a fee of 10 credits in order to resell the item. I think that's fair. Once you vote for that option you are refunded 60% of the original retail price (no refunds for the ammunition, though).
Just knew I was missing something, you'd have thought knowing that it's a kinetic weapon would have sprung to mind.
And thanks also to Cmdr. El Viejo. All these years and still didn't realize that it was just the labour cost of removal.
Also noted that Cmdr. McLane said same.

p.s. A wee note on kinetic physics;
2 cars doing 100mph in a head on colision. Impact speed = 200mph? or 100mph?
answer is each car has the same 100mph to an imovable object if the cars have the same mass.
So shooting a run away cobra and not giving so much damage with my rail gun makes perfect sense.

Thanks Cmdrs.
LOOK OUT!!!
OOPS..
"Press Space" Commander
If you do not see "Press Space" more often than you want.. Your not trying!
User avatar
sdrubble
Deadly
Deadly
Posts: 234
Joined: Fri Aug 05, 2011 8:30 am
Location: Belo Horizonte, Brazil

Re: Railgun.oxp v 1.3 now available

Post by sdrubble »

Hi all - and Commander McLane specially !!!

First poster here, and also new to Oolite - having lotsa fun with this great game - and seems you also got a great and warm community.

After a week or so of being all thumbs at navigation and combat (mind you, logged dozens of LY while still 'Harmless' :x ), I started to notice my kill count increasing a LOT faster.

I started to pay closer attention to it, and earlier today I noticed a 28-kill increase between two consecutive saved games, with only one planet hop between both.

Looking even more closely I started to suspect that each round FIRED from a Medium Railgun would increase my kill count by +1, regardless of it hitting a target or not...

So I've done a specific test couple hours ago: saved game at the station, took note of kill count, launched, pointed away from any movable objects, and fired 3 railgun rounds at the void.

Then I immediately docked back to same station and, after being fined 750 Cr and ordered to perform a hangar cleanup :shock: , actually noticed a 3-kill increase.

I've just read this whole thread and made a general search in the forum, and didn't see anyone else reporting similar oddities.

I suspect this might be related to my specific mix of OXPs and/or any specific settings I might be using. Specifically I'm inclined to blame this on either the Caddy Omega I'm flying or the OoCheat OXP I have installed (which BTW I have not actually used, other than exploring possibilities). I have a number of OXPs, not sure if I should be listing these ATM.

What I DID do (a looong while ago) was to edit my savegame, but I just messed with Credits, never with kill count or anything else for that matter.

I also saw the quote below (from here). I didn't fully understand its meaning and I'm not sure if it would have any bearing on my current issue:
Commander McLane wrote:
Eldon wrote:
Sounds like you only get the kill counted for your elite rating, not for things like taking out your random hits target.
Ah, I hadn't caught the Random Hits reference. And yes, the observation is true.

For the game a railgun projectile is not connected to the player ship, therefore none of the usual hit or kill events are triggered, and the OXP has to "manually" manipulate the appropriate game counters. Obviously that doesn't help other OXPs which rely on the normal triggers.

Spontaneously I'd say that's an unfixable glitch, and I can only advise you to not use your railgun for the final shot on a mission-relevant target, if the mission requires you to kill your target personally.
So ... any tip on how can I (we ??) solve this ? I don't want my kill count to be out of sync with my actual (in)abilities... :?

Cheers
User avatar
Fatleaf
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 1988
Joined: Tue Jun 08, 2010 5:11 am
Location: In analysis mode on Phaelon
Contact:

Re: Railgun.oxp v 1.3 now available

Post by Fatleaf »

The Caduceus is a long ship compared to the Cobra 3. If you haven't tweaked the position for the projectiles to fire from your ship instantly runs into them. That is the different sound you hear now and then. You are awarded a kill for each projectile you run into. I have just tested this with a Caduceus Omega.

Do you find this error message in your log? [railgun.oxp]: A railgun projectile hit the player ship. Normally this should not happen.
Commander McLane wrote:
Open the file railgun-1-firing.js inside the Scripts-folder of railgun.oxp (this is for the small railgun) and find the line

Code: Select all

        this.projectile.position = player.ship.position.add(player.ship.heading.multiply(player.ship.collisionRadius + 10));
Then replace the '10' with a greater number. I'd suggest 50. This will make the projectile to be spawned further away from the nose of your ship. It may be an idea for Commander McLane to include this warning in the read-me!

And may I take a moment to Welcome you to the friendliest board this side of Riedquat.
Find out about the early influences of Fatleaf here. Also his OXP's!
Holds the Ooniversal record for "Thread Necromancy"
Makara
Dangerous
Dangerous
Posts: 122
Joined: Sat Oct 17, 2009 6:34 pm

Re: Railgun.oxp v 1.3 now available

Post by Makara »

Fatleaf wrote:
The Caduceus is a long ship compared to the Cobra 3. If you haven't tweaked the position for the projectiles to fire from your ship instantly runs into them. That is the different sound you hear now and then. You are awarded a kill for each projectile you run into. I have just tested this with a Caduceus Omega.

Do you find this error message in your log? [railgun.oxp]: A railgun projectile hit the player ship. Normally this should not happen.
Commander McLane wrote:
Open the file railgun-1-firing.js inside the Scripts-folder of railgun.oxp (this is for the small railgun) and find the line

Code: Select all

        this.projectile.position = player.ship.position.add(player.ship.heading.multiply(player.ship.collisionRadius + 10));
Then replace the '10' with a greater number. I'd suggest 50. This will make the projectile to be spawned further away from the nose of your ship. It may be an idea for Commander McLane to include this warning in the read-me!
Hmmm - I'd noticed this with the Caddy (Alpha) and assumed it was another manifestation of the weird collision detection with the Caduceus. Unless I am misreading the code, surely the collisionRadius should encompass the whole vessel. So for the impact to happen (with RailGun projectiles), must there be some part of the ship actually outside its own collisionRadius? It does feel connected with the Caddy going pop when not touching anything, maybe this helps shed light on that ongoing mystery?

More on-topic, should there be a <key>counts_as_kill</key> <string>no</string> in the shipdata.plist for each of the projectiles? Or will they only increase the player's kill count when impacting the player's own ship rather than every time they hit something?
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Railgun.oxp v 1.3 now available

Post by Eric Walch »

Makara wrote:
Unless I am misreading the code, surely the collisionRadius should encompass the whole vessel. So for the impact to happen (with RailGun projectiles), must there be some part of the ship actually outside its own collisionRadius? It does feel connected with the Caddy going pop when not touching anything, maybe this helps shed light on that ongoing mystery?
When you place something big, just outside the collision radius, it just means that the centre of that object is outside and not the whole object itself.

But McLane must already have corrected that as in the current 1.3 release, the code reads as:

Code: Select all

this.projectile.position = player.ship.position.add(player.ship.heading.multiply(player.ship.collisionRadius + this.projectile.collisionRadius + 1));
And yes, adding a <key>counts_as_kill</key> <string>no</string> sounds wise.
Makara
Dangerous
Dangerous
Posts: 122
Joined: Sat Oct 17, 2009 6:34 pm

Re: Railgun.oxp v 1.3 now available

Post by Makara »

Eric Walch wrote:
When you place something big, just outside the collision radius, it just means that the centre of that object is outside and not the whole object itself.

But McLane must already have corrected that as in the current 1.3 release, the code reads as:

Code: Select all

this.projectile.position = player.ship.position.add(player.ship.heading.multiply(player.ship.collisionRadius + this.projectile.collisionRadius + 1));
Just double-checked - it was version 1.3 (with this version of the railgun-firing.js code) when my Caduceus self-shoot happened.
sdrubble wrote:
I also saw the quote below (from here). I didn't fully understand its meaning and I'm not sure if it would have any bearing on my current issue:
Commander McLane wrote:
Eldon wrote:
Sounds like you only get the kill counted for your elite rating, not for things like taking out your random hits target.
Ah, I hadn't caught the Random Hits reference. And yes, the observation is true.

For the game a railgun projectile is not connected to the player ship, therefore none of the usual hit or kill events are triggered, and the OXP has to "manually" manipulate the appropriate game counters. Obviously that doesn't help other OXPs which rely on the normal triggers.

Spontaneously I'd say that's an unfixable glitch, and I can only advise you to not use your railgun for the final shot on a mission-relevant target, if the mission requires you to kill your target personally.
So ... any tip on how can I (we ??) solve this ? I don't want my kill count to be out of sync with my actual (in)abilities... :?
Just to clarify a little on what Eldon and McLane* were referring to here, although it isn't relevant to the problem you have uncovered. There are some situations with assassination-type missions where you specifically have to make the kill - you don't get credited if the target happens to die for some other reason (the Random Hits OXP being most notable as it generates an endless stream of such missions). While Commander McLane was ingenious in recreating the bounty / kill score mechanism for the railgun unfortunately there is no way to trigger off the game's events as though the target had been killed with a regular laser or missile. The upshot is that if a railgun delivers the coup de grâce on an assassination target it will be the same as if they had rammed into a rock, or been killed by one of the NPCs in the system. In practical terms it just means that if an assassination target's vessel starts venting plasma, don't use the railgun :wink:

* was Eldon and McLane the name of an 80s cop show? If not, why not? :lol:
User avatar
sdrubble
Deadly
Deadly
Posts: 234
Joined: Fri Aug 05, 2011 8:30 am
Location: Belo Horizonte, Brazil

Re: Railgun.oxp v 1.3 now available

Post by sdrubble »

Howdy all,
Fatleaf wrote:
And may I take a moment to Welcome you to the friendliest board this side of Riedquat.
This is the most important stuff. I already, and most certainly, feel so !!! :D

So, first things first:

inside my I:\Oolite\AddOns\railgun.oxp\Info.plist I can see :

Code: Select all

<string>railgun 1.3</string>
so I'm indeed using the latest OXP version.

Code: Select all

[railgun.oxp]: A railgun projectile hit the player ship. Normally this should not happen.
yessir !!! indeed there's a stack of them in the log.
Fatleaf wrote:
Commander McLane wrote:
Open the file railgun-1-firing.js inside the Scripts-folder of railgun.oxp (this is for the small railgun) and find the line

Code: Select all

this.projectile.position = player.ship.position.add(player.ship.heading.multiply(player.ship.collisionRadius + 10));
Actually, on my I:\Oolite\AddOns\railgun.oxp\Scripts folder I have one 'railgun-firing.js', not one 'railgun-1-firing.js'. I suppose the original issue commented by McLane involved a duplicate file situation for some reason, hence the '-1'. Alas, there seems to be no separate scripts for Small, Medium or Heavy guns - supposed this is scripted elsewhere and this is a universal thing in the current OXP version ?

So indeed on my I:\Oolite\AddOns\railgun.oxp\Scripts\railgun-firing.js I found (thx also Eric for the updated info):

Code: Select all

this.projectile.position = player.ship.position.add(player.ship.heading.multiply(player.ship.collisionRadius + this.projectile.collisionRadius + 1));
which I have commented out and replaced with another line where I'll be testing with increasingly larger values - starting from 5 I guess. Fatleaf had proposed 10 ---> 50 but not accounting for 'projectile.collisionRadius' which is currently factored in, so 5 *might* be a good value with the current formula.

I'll be reporting on my findings later on.

Makara wrote:
Commander McLane wrote:
Eldon wrote:
Sounds like you only get the kill counted for your elite rating, not for things like taking out your random hits target.
Ah, I hadn't caught the Random Hits reference. And yes, the observation is true.

For the game a railgun projectile is not connected to the player ship, therefore none of the usual hit or kill events are triggered, and the OXP has to "manually" manipulate the appropriate game counters. Obviously that doesn't help other OXPs which rely on the normal triggers.

Spontaneously I'd say that's an unfixable glitch, and I can only advise you to not use your railgun for the final shot on a mission-relevant target, if the mission requires you to kill your target personally.
Just to clarify a little on what Eldon and McLane* were referring to here, although it isn't relevant to the problem you have uncovered. There are some situations with assassination-type missions where you specifically have to make the kill - you don't get credited if the target happens to die for some other reason (the Random Hits OXP being most notable as it generates an endless stream of such missions). While Commander McLane was ingenious in recreating the bounty / kill score mechanism for the railgun unfortunately there is no way to trigger off the game's events as though the target had been killed with a regular laser or missile. The upshot is that if a railgun delivers the coup de grâce on an assassination target it will be the same as if they had rammed into a rock, or been killed by one of the NPCs in the system. In practical terms it just means that if an assassination target's vessel starts venting plasma, don't use the railgun :wink:
Thx for the clarification. I had - more or less - understood it previously, but you indeed added a more clear explanation.

Oh, and BTW - would you tell me what do these amounts of 1, 10 and 50 refer to ? Would that be 'in-game meters' ?

See ya soon - cheers
User avatar
sdrubble
Deadly
Deadly
Posts: 234
Joined: Fri Aug 05, 2011 8:30 am
Location: Belo Horizonte, Brazil

Re: Railgun.oxp v 1.3 now available

Post by sdrubble »

sdrubble wrote:
I'll be reporting on my findings later on.
...So here they are.

Equation below is the DEFAULT one in railgun-firing.js :

Code: Select all

this.projectile.position = player.ship.position.add(player.ship.heading.multiply(player.ship.collisionRadius + this.projectile.collisionRadius + 1));
I've done some experimentation (under NON-combat conditions, mind you) with alternative values for the "1" given above. Below are my findings, when flying a Caduceus Omega equipped with a X-150 Medium Railgun :

5 = always BAD !!!
10 = good up to half-speed, BAD at top speed
20, 60, 100 = good when going either slow or fast, BAD when on 'I' (witchdrive) power)
150-250 = MAY be used when on 'I' (witchdrive) power - however, when maintaining a straight flight path, we should release 'I' for a half-second after each 1-2-3 rounds fired, in order to avoid overtaking projectiles and colliding with them AFTER they were successfully fired !!!

Now that I have a feeling of how this works, I might tweak this value further up or down after seeing how this performs under real combat, where you neither keep a straight line for long nor keep the witchdrive connected for long intervals.

Thx everyone again, and cheers !
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Re: Railgun.oxp v 1.3 now available

Post by Thargoid »

You could always make the offset from the ship on launch dependant on the ships speed.
User avatar
Wyvern Mommy
Deadly
Deadly
Posts: 185
Joined: Sat Apr 02, 2011 7:14 pm
Location: Beyond the final Frontier

Re: Railgun.oxp v 1.3 now available

Post by Wyvern Mommy »

sdrubble wrote:
however, when maintaining a straight flight path, we should release 'I' for a half-second after each 1-2-3 rounds fired, in order to avoid overtaking projectiles and colliding with them AFTER they were successfully fired !!!!
that happened to a flight of navy jets once. they fired at a prctice target then went into a dive, overtaking their bullets. several of them found their way into the engines.
User avatar
sdrubble
Deadly
Deadly
Posts: 234
Joined: Fri Aug 05, 2011 8:30 am
Location: Belo Horizonte, Brazil

Re: Railgun.oxp v 1.3 now available

Post by sdrubble »

Thargoid wrote:
You could always make the offset from the ship on launch dependant on the ships speed.
Yes I could ... IF I had an idea of how to program this. Unfortunately I'm not up to the task at the moment... while I DID do some programming in the past, I can't say I know the slightest bit about Java / JavaScript.

Any suggestions / snippets would, of course, be most welcome. :mrgreen:

Some additional thoughts:

1. I don't think any kind of code dealing with the offset for a projectile launch would be able to workaround the fact that a ship at witchspeed is ALWAYS FASTER than a railgun round.

2. If a value of, say 100, will always be OK for sub-witchspeeds, while another one of 250 would be sort-of-OK for witchspeed (see #1), then we wouldn't need a linear variation of values - a simple toggle between 100 and 250 would do, depending on the witchdrive being off or on, respectively.

Cheers
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: Railgun.oxp v 1.3 now available

Post by Capt. Murphy »

I think the solution here would be to disable the railgun entirely if the ship is flying at above it's maxSpeed (i.e it's injecting). Would make sense as a failsafe. I use my railgun a lot (on a Cobra) with no problems but don't think I've ever considered used it whilst injecting.

Alternatively the projectile's velocity calculation (done in railgun-projectile.js) could include the firing ship's speed as a factor. That would make charging under injector speed whilst firing off projectiles at a higher velocity than normal an interesting although possibly not viable combat tactic (projectiles would do more damage, but the collision detection with the intended target would be a lot poorer because they are going faster).

Both of those are more than a simple edit. McClane I don't think has been on the boards for a week or two - hopefully just on holiday or something.

However you could edit your copy easily to tailor the launch position dependant on ship's speed. Use an appropriate text editor and do something along these lines. For the Caddy (maxSpeed = 460) the offset would vary between 1 (player at a dead stop) and 23 (player at normal maxSpeed) at normal speeds and go up as high as 161 at full injectors. For the Cobby (maxSpeed = 350) the offset would between 1 and 18 at normal speeds. Tweak the * 0.05 if those figures don't quite do the trick. Oh and report back to say if it works OK.

Code: Select all

var adjustedOffset = 1 + (Math.round(player.ship.maxSpeed * 0.05 * (player.ship.speed / player.ship.maxSpeed)));
this.projectile.position = player.ship.position.add(player.ship.heading.multiply(player.ship.collisionRadius + this.projectile.collisionRadius + adjustedOffset));
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Railgun.oxp v 1.3 now available

Post by Eric Walch »

What also might help is to remove the setting of the velocity from the ship script of the bullet and set it in the equipment. its more natural because all the other things like position and orientation are set there also. So add the second line below the setting of the orientation.

Code: Select all

        this.projectile.orientation = player.ship.orientation;
        this.projectile.velocity = this.projectile.heading.multiply(this.projectile.scriptInfo.velocity);
And remove the corresponding line from the shipSpawned() part of the shipscript. That code probably runs one frame later when doing it there. And as backup you can make sure that

Code: Select all

if (this.projectile.velocity.magnitude() < player.ship.speed) this.projectile.velocity = player.ship.velocity
(untested code)

And I don't know why the code is constantly calculating the traveled distance because there is a property distanceTravelled on every entity that keeps track of the distance that was traveled. And that one is even more correct for curved lines than just the distance to starting point. (Not an issue for the bullets)
Post Reply