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

Screen delay on arrival at the witchpoint

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6884
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Screen delay on arrival at the witchpoint

Post 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 ...
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Post 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?
Commander Smivs, the friendliest Gourd this side of Riedquat.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6579
Joined: Wed Feb 28, 2007 7:54 am

Post 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.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16079
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Post by Cody »

Brilliant… you should be writing Oofic, a_c.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6884
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Post 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.
User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Post 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.
The glass is twice as big as it needs to be.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5526
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

In space no-one can hear your ship approach, and so you caught the Universe unawares and only half-dressed? :wink:
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post 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:
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post 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! :)
Last edited by Kaks on Thu Dec 16, 2010 10:36 am, edited 2 times in total.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post 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).
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post 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:
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post 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 :)
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post 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!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Post 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?
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post 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.
Post Reply