Page 1 of 1

Screen delay on arrival at the witchpoint

Posted: Fri Dec 10, 2010 2:13 pm
by Disembodied
A cosmetic thing, really, but I was wondering if there could be a brief delay in activating the viewscreens on arrival in a new system. A couple of times, on arrival I've managed to take a quick look out the rear view and have seen e.g. a Convenience Store arriving: it appears in a little ring of light as if it's just witched in itself. Is it possible to install a very brief delay, so that everything that's supposed to be in the system arrives before the player sees it? Maybe disguise it with a bit of static or distortion or something on the viewscreen? It's not a major problem, but it does look a bit odd seeing a station pop into existence ...

Posted: Fri Dec 10, 2010 2:30 pm
by Smivs
I like the idea in principle, but what about those situations where you 'emerge' (traveling at low speed) right in front of the buoy or billboard.
This has happened to me on several occasions and I haven't always been able to stop/change course in time. :roll:
Might this not make this problem worse?

Posted: Fri Dec 10, 2010 2:38 pm
by another_commander
Disembodied wrote:
A cosmetic thing, really, but I was wondering if there could be a brief delay in activating the viewscreens on arrival in a new system. A couple of times, on arrival I've managed to take a quick look out the rear view and have seen e.g. a Convenience Store arriving: it appears in a little ring of light as if it's just witched in itself. Is it possible to install a very brief delay, so that everything that's supposed to be in the system arrives before the player sees it? Maybe disguise it with a bit of static or distortion or something on the viewscreen? It's not a major problem, but it does look a bit odd seeing a station pop into existence ...
Ehm... yeah... see, this is an after-effect of the hyperspace sequence. The entities are already there and they don't pop into existence, it's just that you are seeing something similar to the dark spots/shapes appearing when you close your eyes after having stared at bright light for a while. This has been reported by pilots on various occasions in the past and it is all explained in detail in the article "An Analysis of Residual and Temporal Effects of Hyperspace Transit", published in the GalCop Scientific Journal vol.2, Pages 24-30, University of Lave Publications, 3109.

Posted: Fri Dec 10, 2010 2:42 pm
by Cody
Brilliant… you should be writing Oofic, a_c.

Posted: Fri Dec 10, 2010 4:15 pm
by Disembodied
another_commander wrote:
Ehm... yeah... see, this is an after-effect of the hyperspace sequence. The entities are already there and they don't pop into existence, it's just that you are seeing something similar to the dark spots/shapes appearing when you close your eyes after having stared at bright light for a while. This has been reported by pilots on various occasions in the past and it is all explained in detail in the article "An Analysis of Residual and Temporal Effects of Hyperspace Transit", published in the GalCop Scientific Journal vol.2, Pages 24-30, University of Lave Publications, 3109.
A pinch of handwavium is worth a pound of programming! :D I'm completely convinced.

Posted: Fri Dec 10, 2010 5:21 pm
by Micha
The alternative to handwavium would be to keep displaying the wormhole tunnel effect until the universe has finished setting itself up. It would be a lot more effort though.

Posted: Fri Dec 10, 2010 7:24 pm
by Thargoid
In space no-one can hear your ship approach, and so you caught the Universe unawares and only half-dressed? :wink:

Posted: Fri Dec 10, 2010 7:47 pm
by Commander McLane
Isn't that what the shipWillExitWitchspace-handler is for? To spawn entities which are supposed to already be there when the player gets spawned?

By the way, the obvious wrongness of having stations close to the witchpoint appear like they just jumped in is why I requested an optional suppress-witchspace-exit-rings parameter for the ship spawning functions. I wasn't heard by the powers-that-be. :cry:

Posted: Thu Dec 16, 2010 1:48 am
by Kaks
Totally untested, but this:

Code: Select all

system.addShipsNoRings = function (role,count,position,radius) {
   if (count-0 < 1) count = 1;
   var offset =new Vector3D(0,50000,0);
   var ships=system.addShips(role, count, offset,radius);
   if (position) offset=position.subtract(offset);
   else offset=offset.multiply(-1);
   var i=0;
   while (i++<ships.length){
      ships[i].position=ships[i].position.add(offset);
   }
   return ships;
}
should do the trick... barring the odd logic mistake or two! ;)
Edit: thanks Ahruman!
...and still waiting for brave testers to verify whether this works or not! :)

Posted: Thu Dec 16, 2010 6:29 am
by JensAyton
Kaks wrote:
else offset=[0,0,0].subtract(offset);
Unless someone’s been mucking about behind my back, that needs to be new Vector3D(0, 0, 0).subtract(offset), or alternatively offset.multiply(-1).

Posted: Thu Dec 16, 2010 11:53 am
by Eric Walch
Kaks wrote:
Totally untested, but this:

Code: Select all

system.addShipsNoRings = function (role,count,position,radius) {
   if (count-0 < 1) count = 1;
   var offset =new Vector3D(0,50000,0);
   var ships=system.addShips(role, count, offset,radius);
   if (position) offset=position.subtract(offset);
   else offset=offset.multiply(-1);
   var i=0;
   while (i++<ships.length){
      ships[i].position=ships[i].position.add(offset);
   }
   return ships;
}
should do the trick... barring the odd logic mistake or two! ;)
Edit: thanks Ahruman!
...and still waiting for brave testers to verify whether this works or not! :)
Also untested, but there is an other problem. In my current experience with JS is "position" always transferred as an array, even when explicit defining position a Vector3D-object in the calling function. This results in

Code: Select all

offset=position.subtract(offset);
giving an error. To prevent this error I always had to start with

Code: Select all

position = new Vector3D(position)
to be able to use the position in calculations.

When using "position" in a addShips method there is no problem as those accept arrays, but not when used in Vector3D methods.

That is the big minus of JS were you can't declare any types. You also needed tricks in above code to make sure that "count" is a number. I almost want back to my Algol 60 days, the first language I had to learn. It felt that in Algol60 every variable was at least declared twice to be on the sure side. :wink:

Posted: Thu Dec 16, 2010 3:15 pm
by Eric Walch
Kaks, just tested your code. Explicit converting the position was not needed as I stated above. Probably because you assign it to 'offset' what already was a Vector3D.
The counter was wrong as it tried to access one ship to much. (Although I fail to so why your formulation generated errors for 'ships') Following code is tested to work.

Code: Select all

system.addShipsNoRings = function (role,count,position,radius) { 
   if (count-0 < 1) count = 1; 
   var offset =new Vector3D(0,50000,0); 
   var ships=system.addShips(role, count, offset,radius); 
   if (position) offset=position.subtract(offset); 
   else offset=offset.multiply(-1); 
   var i=0; 
	while (i < ships.length) 
   { 
      ships[i].position=ships[i].position.add(offset); 
	  i++;
   } 
   return ships; 
}
Than using system.addShipsNoRings(role,count,position,radius) adds the ships without rings and nicely returning the ship array :)

Posted: Thu Dec 16, 2010 9:51 pm
by Kaks
Oops! I know exactly why! The test itself was correct, but when inside the while loop the i was already incremented..

Memo to self: do not write code at 1:48 am, especially when you've got no way of testing it!

Posted: Fri Dec 17, 2010 3:56 am
by Switeck
Eric Walch wrote:
Than using system.addShipsNoRings(role,count,position,radius) adds the ships without rings and nicely returning the ship array :)
You going to use this command for the constore in Your Ad Here OXP?

Posted: Fri Dec 17, 2010 8:50 am
by Eric Walch
Switeck wrote:
Eric Walch wrote:
Than using system.addShipsNoRings(role,count,position,radius) adds the ships without rings and nicely returning the ship array :)
You going to use this command for the constore in Your Ad Here OXP?
Yes, I already added it in my version. But now as 'this.' version of the method because an oxp should not add methods to the system object.

I agree with Disembodied that seeing the rings gives a wrong sensation. But because it was hard to get them in sight because the stations are always added behind the player, I did use the new addShip method because of the reference to the added ships.

For YAH I can use a simplified version of the oxp as 'count' will always be zero.

For general use is the above method not complex enough. It should read as:

Code: Select all

this.addShipsNoRings = function (role,count,position,radius) { 
   if (count-0 < 1) count = 1; 
   var offset =new Vector3D(0,50000,0); 
   var ships=system.addShips(role, count, offset, radius); 
   if (position) offset= new Vector3D(position).subtract(offset); 
   else offset=offset.multiply(-1); 
   var i=0; 
   while (i < ships.length) 
   { 
      ships[i].position=ships[i].position.add(offset); 
      if (ships[i].escorts) 
      { 
        var j=0; 
        while (j < ships[i].escorts.length) 
        { 
            ships[i].escorts[j].position=ships[i].escorts[j].position.add(offset); 
            j++ 
        } 
      } 
      i++; 
   } 
   return ships; 
}
If not, you will leave the escorts behind at the wrong location. (although they will meet with their mother after some minutes of flying :lol: )

And I also added in the conversion of position to a Vector3D. If not, something like this.addShipsNoRings("constore", 1, [0, 5E3, -30E3], 10E3) will not work as position is transferred as an array in most code.