Jump to content

alphafalcon

Members
  • Posts

    24
  • Joined

  • Last visited

Reputation

0 Neutral

Profile Information

  • About me
    Bottle Rocketeer
  1. Got TCP running, thanks to some help r4m0n. Now I\'ll have to think about what to send over the line. Warringer, what data would you need for your calculator? UDP seems more suited to the task, now you mention it. Will have to try that sometime, I\'m not that familiar with UDP. Quinton, yeah theres a way to semi-reliably identify a ship: this.vessel.vesselName has the Major Drawback that most of my Ships are called 'Untitled Spacecraft' atm.
  2. I offer the following question to the coding oracle: Where can I initialize and destroy a TCPListener reliably, so its only active while I\'m flying a rocket. At the moment I\'m doing this (link to other post). In short I\'m overriding OnPartUpdate and check every tick whether my Listener is null. I hav no idea where to close down the socket yet. Thanks for your help.
  3. Okay, I\'m stuck. This works, but just once. If you compile this, put a part on your ship and launch it, you can connect to port 50000 and receive lots of 'hello's. If you 'End Flight', launch the same ship again, the connect fails. I think i need some kind of cleanup, to close the connection and reinitialize the Listener, but I\'ve got no idea where to put it. Tried OnPartDelete, but didn\'t do the trick... Suggestions? Also, I\'m kinda new to C#, so please excuse glaring stupidities, if there are. Someone get me python bindings ;P using System.Net; using System.Net.Sockets; /// <summary> /// Description of MyClass. /// </summary> /// public class TelemetrySensor : Part { private TcpListener _listen; private TcpClient _client; protected override void onPartUpdate() { if (_listen == null) { _listen = new TcpListener(IPAddress.Parse('127.0.0.1'),50000); _listen.Start(); } if (_listen.Pending()) { _client = _listen.AcceptTcpClient(); } if (_client.Connected) { byte[] msg = System.Text.Encoding.ASCII.GetBytes('Hello\r\n'); _client.GetStream().Write(msg,0,msg.Length); _client.GetStream().Flush(); } } }
  4. So I decided to break out SharpDevelop and have a look myself... Holy Cow, the possibilities This little bit public class TelemetrySensor : Part { protected override void onActiveUpdate() { base.onActiveUpdate(); print('flight state:'); print(this.vessel.altitude); print(this.vessel.orbit.eccentricity); } } already spews useful info into the debug log. Now I just need to find all relevant parameters, pipe that into a network socket and the orbit calculator guys can have a go at it. 8)
  5. That is clearly easier than getting orbital data, if KSP doesnt provide it somehow. I\'m not quite sure I understand you correctly, but I believe you want to know how to get the data to the orbit calculator: I\'m thinking of sending it over the loopback network interface.
  6. As this seems the most appropriate place for coding-related questions ill put this here: What kind of in-game data can a module access? I\'ve seen the Solar Panels which communicate with batteries somehow, but can a module know about(or even alter) orbital parameters like which body it is orbiting, orbital velocity, eccentricity and so on. I\'m wondering wether a 'telemetry downlink' module would be possible, which would collect data ingame and serve it on the loopback interface so our favourite orbit calculator can read it and display more detailled orbit stats or even aid in transfer maneuvers. Hope to hear something encouraging from you code-divers. alphafalcon out. Edit: Changed title to reflect discussion
  7. GREAT tool! One question, what is the Velocity Vector in the Launch Orbit tab? Where can i see that in-game? and how do i enter it? degrees?
×
×
  • Create New...