Jump to content

TheMightySpud

Members
  • Posts

    30
  • Joined

  • Last visited

Reputation

2 Neutral

Profile Information

  • Location
    Middle of the UK

Recent Profile Visitors

1,247 profile views
  1. Okay then, I've figured out that it's not actually anything to do with the Collision (well not in the way I thought anyway). The Destruction Collider error is related to the space center 'scene' and appears all the time, mod or no mod. I have found something very odd going on though which I believe is the culprit, but not really sure how to fix it. Everything is all dandy and happy until I go to the launchpad or the runway. If I remove the bits and pieces of code that moves the stargate after it's spawned, everything works great, except it isn't in the right place. after a quick look and compare of the savegames however I noticed something odd. The Stargate 'vessel' is made up of a single part. I've looked at the savegame file at every step of the way (space center -> tracking station -> space center - > VAB or SPH -> Launch Pad or Runway. Everytime I've gone through, it's all good until I go to the launch pad or runway, at which point after the autosave I look at the save game again, and suddenly my 'Vessel' has two identical parts. Has anyone come across this before, or know why it's happening? It's so very very very weird, I really don't get it. Thanks TheMightySpud
  2. On my previous version of the gate model there were a bunch of convex mesh colliders, but on this version, just to test it has a single box collider, which is why I think I'm getting far better frame rates even though I'm still getting the errors (only throwing the exception for one collider instead of a bunch). The part that's confusing me is that in the log, there is a line that's saying it can't find an object called 'DestructionCollider' it's looking for it in the KPS file structure, but it's not there so obviously it won't be able to find it. So I started to wonder whether it was something I was doing in Unity when compiling the model. But then I thought that can't be it because I can use the part in the editors and get it to the launch pad/runway and it works fine. I'll try the trigger mesh thing once I figure out what that is lol. Thanks for the insight TheMightySpud
  3. Ooooooh, an update. Okay so I figured that the errors above I were definitely something to do with my collisions. However, I have no idea what. But I took a chunk off my Stargate model, and replaced the mesh collider with a box collider and tried placing that instead. I still get the errors, but I'm back up to a manageable frame rate so I can carry on with other things while I try and figure out what's going on with that. So I figured I'd show a pic. Modelling is done on the gate, haven't started on the texturing yet though. I may get shouted at for this one, but the Tri count as it stands is at 25,740. Which is a little high, and I may be able to squeeze it down a bit. But as this is one part, I figured I could get away with it for the time being. Soooo, obviously because there are no textures, not really a great deal to see, but you get the idea. If anyone has any insight into the errors, I would be most appreciative Thanks TheMightySpud
  4. Thanks So now on to the next problem. lol. I've got the gate appearing where I want it to (based on where I put it in a save file). It places fine, but as soon as I go to the launch pad, KSP goes nuts. lol. https://github.com/TheMightySpud/TMS_Orbital_Mechanics/blob/master/Source/CreateGates.cs#L151-L168 This is my positioning code, which works perfectly as far as I can tell. In the log, this all happens a long time before it goes mental. Spawning into orbit is also fine and dandy. This is my log, I'm not really sure what's going on if honest, if I had to guess, there's some problem with the collision detection, but I'm not sure, and have no idea how to fix it if it is. In the game the Stargate is sitting on the ground quite nicely, but fps drops to almost nothing as the exception is kicked back on every frame, even after the physics have eventually kicked in. :-/ As you can see there are a couple of other errors in there too, which I don't get when spawning in orbit. So I would assume there's something wrong with my positioning somewhere. Thanks TheMightySpud
  5. YES!!!!!!! You sir, are an absolute Prince. I now have an orbiting Stargate on startup :-D Me so happy. Now to dissect a save file for positional data. :-D *giddy as a schoolgirl* lol. Seriously though @Starwaster, thank you so much TheMightySpud
  6. After a very quick poke around with google, I found this (DarkMultiplayer code) https://github.com/godarklight/DarkMultiPlayer/blob/master/Client/ScenarioWorker.cs#L241-L266 Which seems to do pretty much the same thing (with a few differences obviously). I'll have a play with that and see what I can come up with TheMightySpud
  7. Thanks for the reply once again In the log I'm getting no exceptions whatsoever, just that little popup window when it tries to load the .craft Format wise, I'm using a craft file saved from the editor with the edits made (adding STARGATE { VESSEL { at the beginning and } } at the end. (I can't see any other differences in the cfg you provided) So at the moment, it seems that everything is working as it should up to the point where it actually adds the contents of the Part nodes to the actual vessel. The 'stargateParts' list is populated as demonstrated by the Debug.Log lines (the expected information appears in the Log. I am beginning to think that there has been some sort of change in the API between versions. I get the same error no matter what parts I use to create a craft file (I tried a few different single part ships, just to see if it was something I was doing in my gate Part). I'll try running through the part(s) I have attached to a ship and see what pops up. Failing that, I'll have a closer look at the CreateVesselNode() and see if I can figure something out. Thanks TheMightySpud
  8. Hi all, So, problem number one on my 'to do' list. Getting a single gate to spawn anywhere. Using this code https://github.com/TheMightySpud/TMS_Orbital_Mechanics/blob/master/Source/CreateGates.cs which is derived from this code...... https://github.com/Starwaster/Ioncross-Crew-Support/blob/master/Source/IoncrossCrewSupport/Contracts/Templates/IonContractResupply.cs Which was so graciously offered up by @Starwaster I receive this error when trying to spawn the Gate either from entering the Space Center, or entering 'flight' Based on the outputs from the Log, the code is finding all the necessary information from the config file, which is great. Originally I thought the problem was something to do with the following line. https://github.com/TheMightySpud/TMS_Orbital_Mechanics/blob/master/Source/CreateGates.cs#L102-L106 But the Debug lines that follow it print the information asked for to the Log, so I know that there's information in there. However it doesn't seem to be getting added to the vessel at this point like it should.... https://github.com/TheMightySpud/TMS_Orbital_Mechanics/blob/master/Source/CreateGates.cs#L123-L129 The only thing I can think of is that I'm missing something important from the original code, but I honestly can't see what, and I spent most of yesterday going through it line by line several times to try and find something that I missed. I'm hoping that someone with a fresh pair of eyes can see where I'm going wrong and point me in the right direction. Thanks TheMightySpud
  9. Hi all, As my other thread evolved into what this thread was always meant to be (eventually), I figured I'd just jump right in and make my Mod Development thread. I will have a lot of questions as I am still getting my head around how c# and the api works. I have created a Git repository for the Mod as it currently is (or rather isn't, nothing quite works yet), but it will make things easier than me pasting code all the time The readme has some basic information about the mod and what I'm looking to achieve, the readme itself is still a work in progress so may have some bits missing. https://github.com/TheMightySpud/TMS_Orbital_Mechanics This is just the introductory post, I'll be adding more and having breakdowns/tantrums in other posts further down the line when things go horribly wrong So, on with the show as they say. TheMightySpud
  10. Well, I got around to setting myself a git repository so it should be a lot easier to read the stuff I'm going to be asking about Also added the beginnings of a readme with most of what I'm trying to accomplish, so it may give everyone a better idea. I'm going to end this thread, and create a new one specifically for the mod as this was supposed to be general questions and it has evolved somewhat. TheMightySpud
  11. Thanks again for that After playing around for a bit more adding in those few lines, it turns out it's doing what it supposed to (It's finding the Node(s) called PART, but the problem is It doesn't seem to be adding any of the info inside the PART node(s) into the ship, which is why I'm getting the 'Craft File not loaded because of missing part ..........' Error when I start up KSP. I'll have a bit more of a play to see if I can figure it all out TheMightySpud
  12. My apologies, it's getting late and I overlooked including the log. Anyway, this is what happened in the log. As you can see the stargateList (Gates in list) has 1 entry, which it should have. the stargateList[0].name comes out as 'VESSEL' (Stargate NameVESSEL) which if I'm look at this correctly, it should really be the ship name as defined in the cfg file (which is a slightly modified craft file), and then when I try to grab the PART in the line I mentioned in my previous post, I get a stargateParts[0] value of PART (Part NamePART), which should (I believe) be the actual part assigned to the ship. All of this is a lot of guesswork tbh but I'm learning, and picking up how stuff works. As for Github, I don't have one as yet, but I plan to sort it out this weekend sometime. Really appreciate the help TheMightySpud
  13. Hooooookay, Spent a couple of hours trying to figure this out and have gotten nowhere. :-/ // ------------------------------------------------------------------------------ // <autogenerated> // This code was generated by a tool. // Mono Runtime Version: 4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </autogenerated> // ------------------------------------------------------------------------------ using KSP; using UnityEngine; using Contracts; using Contracts.Parameters; using System; using System.Collections.Generic; using System.Linq; namespace TMS_Stargate { public class CreateGates : MonoBehaviour { //Define a load of lists and variables private List<ConfigNode> stargateList = new List<ConfigNode>(); private CelestialBody gateBody = null; private string _planet; public string stargateName = "Unnamed Stargate"; public List<ConfigNode> GetProtoGate() { //Defines our list of Stargates Debug.Log("TMS ORBITAL MECHANICS - Defining our Gate List"); List<ConfigNode> Stargates = new List<ConfigNode>(); Debug.Log("TMS ORBITAL MECHANICS - Defined our Gate List"); //Loops through all the configs to find any starting with a Node called STARGATE Debug.Log("TMS ORBITAL MECHANICS - About to Start our first foreach Loop"); foreach (ConfigNode gates in GameDatabase.Instance.GetConfigNodes("STARGATE")) { Debug.Log("TMS ORBITAL MECHANICS - Gates in list = " + Stargates.Count); Debug.Log("TMS ORBITAL MECHANICS - found STARGATE node"); Debug.Log("TMS ORBITAL MECHANICS - About to Start our Second ForEach loop"); //Finds all the VESSEL Nodes in our Configs foreach (ConfigNode stargate_candidate in gates.GetNodes("VESSEL")) { //Adds any relevant items from the Configs to our Stargate List Debug.Log("TMS ORBITAL MECHANICS - found VESSEL node"); Debug.Log("TMS ORBITAL MECHANICS - Adding to candidate List"); Stargates.Add(stargate_candidate); Debug.Log("TMS ORBITAL MECHANICS - Gates in list = " + Stargates.Count); } } //Sends the completed list back to the main bit Debug.Log("TMS ORBITAL MECHANICS - Returning Info"); return Stargates; } public void BuildGate(string planet) { //Defines which planet/moon we are referencing this._planet = planet; Debug.Log("The Commencement has Beginulated"); foreach (CelestialBody targetBody in FlightGlobals.Bodies) { Debug.Log("TMS ORBITAL MECHANICS - Found Body " + targetBody); if (targetBody.name == _planet) gateBody = targetBody; } Debug.Log("Locked on to " + gateBody); Debug.Log("TMS ORBITAL MECHANICS - Trying to Spawn a Gate"); //Sends a request to 'GetProtoGate' to grab info we can use. Debug.Log("TMS ORBITAL MECHANICS - Going to GetProtoGate"); stargateList = GetProtoGate(); Debug.Log("TMS ORBITAL MECHANICS - Coming back from GetProtoGate"); //Checks to make sure we're getting something back if (stargateList.Count <= 0) { Debug.Log("TMS ORBITAL MECHANICS - about to return false (empty fleet nodes; unable to spawn)"); //return false; } //Give our Stargate a name stargateName = gateBody.bodyName + " Stargate"; Debug.Log("TMS ORBITAL MECHANICS - Stargate Name = " + stargateName); //Defines out unique flightID Debug.Log("TMS ORBITAL MECHANICS - assign Flight ID"); uint uniqueFlightID = ShipConstruction.GetUniqueFlightID(HighLogic.CurrentGame.flightState); Debug.Log("TMS ORBITAL MECHANICS - Stargate Name" + stargateList[0].name); //Tries to get all the parts from our loaded vessel config file Debug.Log("TMS ORBITAL MECHANICS - Get Parts"); ConfigNode[] stargateParts = stargateList[0].GetNodes("PART"); Debug.Log("TMS ORBITAL MECHANICS - Part Name" + stargateParts[0].name); //Define our orbit details (Needs heavy editing to put our gates exactly where we want them. Ideally getting info from TMS_Stargate.cs) Debug.Log("TMS ORBITAL MECHANICS - Defining Orbit Details"); double lowOrbit = Math.Max(gateBody.Radius + gateBody.Radius * 0.15, gateBody.Radius + (double)gateBody.atmosphereDepth * 2.0); double highOrbit = Math.Max(gateBody.Radius + gateBody.Radius * 0.2, gateBody.Radius + (double)gateBody.atmosphereDepth * 2.3); Debug.Log("TMS ORBITAL MECHANICS - Defining Parameters config node"); //Define our parameters node (not actually sure what this does if honest) ConfigNode[] parameters = new ConfigNode[] { ProtoVessel.CreateDiscoveryNode(DiscoveryLevels.Unowned, UntrackedObjectClass.A, 50000 * 2.0, 50000 * 2.0) }; //Assign our orbit details to our actual orbit Debug.Log("TMS ORBITAL MECHANICS - Creating Orbit details"); Orbit orbit = Orbit.CreateRandomOrbitAround(this.gateBody, lowOrbit, highOrbit); //Define and add our details to the ProtoVessel Debug.Log("TMS ORBITAL MECHANICS - Adding all info to the ProtoVesselNode"); ConfigNode protoVesselNode = ProtoVessel.CreateVesselNode(stargateName, VesselType.Station, orbit, 0, stargateParts, parameters ); //Add our ProtoVessel to the game Debug.Log("TMS ORBITAL MECHANICS - Adding our Gate to the game(I think)"); ProtoVessel protoVessel = HighLogic.CurrentGame.AddVessel(protoVesselNode); } } } Here's what I've got (Yes, it's a Stargate Mod, don't judge me. lol.) All credit to @Starwaster for the code, making more headway with this than I have any other. I've got the thing to read the file and attempt loading, but there's a line that's causing a bit of a problem. This little nugget seems to refuse to read the parts of the loaded file. ConfigNode[] stargateParts = stargateList[0].GetNodes("PART"); In Starwasters original code this was set to look for a random value based on how many items were in the 'stargateList' however as this will only ever return a single item, I've set it to 0. But I can't see what it won't get the parts. :-/ Thanks. TheMightySpud
  14. AH HAAAAA!!!! Thank you so so so so so so so much. Got it to read everything, now I'm getting a new error. lol. This one is an 'in game' error saying that it can't load the vessel because of a missing part, but it doesn't say which part, it's just blank.....lol. Well, time to go and mess about with stuff Thanks again TheMightySpud
  15. The cfg is currently in 'GameData/MyMod/PluginData/' So very confused as to why it's not working. I'll have a look for the debug mode thingy you mentioned, Thanks for that Thanks TheMightySpud
×
×
  • Create New...