• Content count

  • Joined

  • Last visited

Community Reputation

78 Excellent


About Dagger

  • Rank
    LMP Developer

Contact Methods

  • Website URL https://github.com/gavazquez
  • Skype gabriel.spain

Profile Information

  • Location Madrid, Spain

Recent Profile Visitors

1,382 profile views
  1. Dagger

    [1.4.5] Luna multiplayer (LMP) - Beta

    I did a lot of improvements in nightly so the next one will be even smoother I just need to find a nice way of syncing part modules....
  2. I see that class in the api (https://kerbalspaceprogram.com/api/class_vessel_teleporter.html#adf79a0a401fd2d6512111f68a448e93d) but I can't use it even in 1.4.4 I'm also interested in this as with LMP I'm having issues when moving a vessel that is on physics range (unpacked)
  3. Dagger

    [1.4.5] Luna multiplayer (LMP) - Beta

    Hi guys, I just wanted to remind you that this mod is made on my spare time, at this moment we are only 2 developers and it's not an easy task to make something designed for single player available to several players, the mod is still in beta, it's not in the addons release forum as it's not stable. If there's some bug/improvement and you want it solved ASAP, feel free to fix it and do a push request as other developers have done. Besides this, let me remind you of the wiki page (https://github.com/LunaMultiplayer/LunaMultiplayer/wiki) most of the issues I've seen are explained there
  4. Found it! Using the sidereal rotation period it's a simple rule of 3. Example: https://wiki.kerbalspaceprogram.com/wiki/Kerbin Kerbin sidereal is 21549.425 seconds so we know it makes a 360º turn in that time If we have a interpolation of 2 seconds---> 21549.425 ----------- 360 2 --------------- X 2*360/21549.425 = 0.3341 That's the amount of degrees that I should add to the LAN that a player sent me Thank you all for your help!!
  5. Thanks a lot!! It worked. By trial and error I've found that adding "0.033" to the LAN value of the received data and with an interpolation delay of 2 seconds the positioning is almost perfect! Now I will try to do the maths and find how to get such value
  6. Just had a look at the code and it seems nice the issue is that I play with orbital parameters and not lat/lon/alt as they allow me to have a more fluid movement. I guess that in this case I should fix the "LAN" orbital parameter only? I think that's the only one that can be affected by the planet rotation considering there's no axial tilt... Picture for reference:
  7. I'm terrible at maths but definitely, tomorrow I will try to do it and contact you if I get stuck. Thanks a lot for the guidelines
  8. Thanks, I will have a look at that
  9. Yes, I would say that it's always east. Or at least when flying around KSC it's always like that I also tried to fix that by setting this code but with no success: planetPos = Vessel.orbitDriver.referenceBody.getPositionAtUT(lerpTime) Vector3d vector3d = Vessel.orbitDriver.driverTransform.rotation * Vessel.localCoM; Vessel.SetPosition((planetPos + Vessel.orbitDriver.pos) - vector3d); I'm very sure I'm missing something but my math knowledge and specially KSP positioning is really bad
  10. Hi, in order to implement a safer interpolation mechanism on LMP I store the orbital positions in a queue and replay them after 2 seconds have passed. The code looks something like this: var startTime = KspOrbit.epoch; var targetTime = Target.KspOrbit.epoch; var currentPos = KspOrbit.getRelativePositionAtUT(startTime); var targetPos = Target.KspOrbit.getRelativePositionAtUT(targetTime); var currentVel = KspOrbit.getOrbitalVelocityAtUT(startTime) + KspOrbit.referenceBody.GetFrameVelAtUT(startTime) - Body.GetFrameVelAtUT(startTime); var targetVel = Target.KspOrbit.getOrbitalVelocityAtUT(targetTime) + Target.KspOrbit.referenceBody.GetFrameVelAtUT(targetTime) - Target.Body.GetFrameVelAtUT(targetTime); var lerpedPos = Vector3d.Lerp(currentPos, targetPos, LerpPercentage); var lerpedVel = Vector3d.Lerp(currentVel, targetVel, LerpPercentage); Vessel.orbit.UpdateFromStateVectors(lerpedPos, lerpedVel, LerpBody, Planetarium.GetUniversalTime()); KSPOrbit is the first packet Orbit, Target.KSPOrbit is the next packet, and on every fixed update frame that code is called. In order to ignore FlightIntegration issues I only call this when vessels are PACKED (OnRails) (I will deal with FI later) The LerpPercentage is a value between 0 and 1 that increases on every fixedupdate call The movement is very fluid BUT the positions are displaced kind of "backwards" This is for example a screenshot I took with 2 clients side by side: Here the player 1 is flying above that wide line in the runway: https://imgur.com/0oPcYHH But the player 2 sees this: https://imgur.com/HlEmoxJ I understand the GREEN distance as the vessel is 2 seconds behind and it will take some time to reach the runway but I don't understand why it's displaced sideways (red distance) Also, I tried to set this code: var lerpTime = LunaMath.Lerp(startTime, targetTime, LerpPercentage); Vessel.orbit.UpdateFromStateVectors(lerpedPos, lerpedVel, LerpBody, lerpTime); But then the orbit is rendered in real time (not 2 seconds behind in time) and the vessel goes inside Kerbin a lot of times and there are weird movements. I think there's some orbital calculation that I'm missing but I can't find how should I proceed on this... I even tried specifying the position manually as: Vector3d vector3d = Vessel.orbitDriver.driverTransform.rotation * Vessel.localCoM; Vessel.SetPosition((planetPos + Vessel.orbitDriver.pos) - vector3d); But I didn't had luck Does someone have an idea of how I should implement this? It's honestly one of the oldest LMP bugs and I've been dealing with this for months and not making much progress. EDIT: If I reduce the interpolation delay time to 300ms or so the movement is almost perfect (there's still that sideway distance altough much shorter) but I want to set a 1 or 2 seconds delay for bad connections
  11. Dagger

    Spawn craft

    You can serialize the protovessel to a config node, then the config node to a string. You can check the code on LMP. https://github.com/LunaMultiplayer/LunaMultiplayer/blob/f2192f0cbbfa74df6a698dffa3ec29c73d76e681/Client/VesselUtilities/VesselSerializer.cs
  12. I do exactly as you do @linuxgurugamer on LMP. I must reproduce part syncronization over network so for example if a player extends a ladder it's extended in the other clients aswell. Some part modules have events (when storing/transmitting science experiments for example) but most part modules don't so I run trough every part module at an interval to check for changes. I wish every "KSPField" triggered an event when they are modified but unfortunately that would need to be done by Squad EDIT: Of course if you do your own partmodule you should do what MOARdV say but if you want to detect changes in the squad part modules (ModuleEngines, ModuleLight, etc) you need to do it with a loop
  13. I have it named as: KSP_x64_Dbg.exe and it works fine for me. But in mi case the linked folder is KSP_x64_Dbg_Data so that might be it...
  14. Dagger

    [1.4.5] Luna multiplayer (LMP) - Beta

    Yes. I'm fixing that behavior. As you are on nightly version some work is still not finished
  15. Dagger

    [1.4.5] Luna multiplayer (LMP) - Beta

    Not really about those mods, but there was a guy on the discord that wanted to do it and he made a page about it https://github.com/LunaMultiplayer/LunaMultiplayer/wiki/Supported-mods if you manage to test some other mods let us know to add them