braininator Posted July 27, 2014 Share Posted July 27, 2014 I didn't realize you made a new thread You didn't mention it in the PF CE thread. It looks great so far I am glad planets are getting the justice they deserve again Also... As long as the cfg system is simple enough, I personally think it might be slightly better suited for something like this. The reason I think this is that you are unlikely to get tons of low quality planets because the people that make the planets have to be slightly more invested. Either way... good luck Link to comment Share on other sites More sharing options...
NathanKell Posted July 27, 2014 Share Posted July 27, 2014 BTW my next task for MSS (was RSS) is a generic PQSMod mangler that will allow you to add, remove, and edit any PQSMod. I'm happy to join forces if you're interested. Link to comment Share on other sites More sharing options...
BryceSchroeder Posted July 27, 2014 Author Share Posted July 27, 2014 (edited) BTW my next task for MSS (was RSS) is a generic PQSMod mangler that will allow you to add, remove, and edit any PQSMod. I'm happy to join forces if you're interested.Sure. What's your username on github?(edit) Nevermind, I took a wild guess that it's the guy named NathanKell with the same avatar. I hope.Also, Teknomann117 and I have been coordinating our efforts with gchat, but I also have an IRC channel we can use if you don't like gchat or something. Edited July 27, 2014 by BryceSchroeder Link to comment Share on other sites More sharing options...
Teknoman117 Posted July 27, 2014 Share Posted July 27, 2014 Figured I'd give some update - Bryce added in some more celestial body information into the mod and now you can orbit the custom planet. Currently, I'm trying to figure out where the PQS data is encapsulated in the system prefab (if at all). CelestialBody.pqsController is null in the prefab. Link to comment Share on other sites More sharing options...
KCreator Posted July 27, 2014 Share Posted July 27, 2014 (edited) The PQS is located in the localSpace GameObject, you can find it by grabbing the object that has the CelestialBody component, so something like GameObject localspace = planetCB.gameObject, should get the object that you can add PQS too.edit: maybe I should test this by adding a PQS to Jool... That could be fun! Edited July 27, 2014 by KCreator Link to comment Share on other sites More sharing options...
aftokinito Posted July 27, 2014 Share Posted July 27, 2014 Figured I'd give some update - Bryce added in some more celestial body information into the mod and now you can orbit the custom planet. Currently, I'm trying to figure out where the PQS data is encapsulated in the system prefab (if at all). CelestialBody.pqsController is null in the prefab.https://dl.dropboxusercontent.com/u/8061287/Kopernicus/Screenshot.2014.07_12.32.11.pngThe PQS as well as the PQSMods are componenents of the GameObject.You can easily get the GO from the CB using the .gameObject var.EDIT: Ninja'd, I should start pressing F5 before posting... Link to comment Share on other sites More sharing options...
BryceSchroeder Posted July 27, 2014 Author Share Posted July 27, 2014 Demonstrating re-arranging stock bodies; in this case, a Pol is inserted orbiting Dres. Modifiying stock bodies will be necessary for backward compatibility with PlanetFactory, as well as supporting new systems that contain stock planets as part of their complement of celestial objects.Jeb is smiling, meaning that he approves of this endevour, presumably. Link to comment Share on other sites More sharing options...
NathanKell Posted July 27, 2014 Share Posted July 27, 2014 rbray adds a PQS to Jool in EVE Overhaul. You can check the code in the Overhaul branch.BryceSchroeder: got the mail! Thanks! I'll send you a PM with my email. Link to comment Share on other sites More sharing options...
Teknoman117 Posted July 27, 2014 Share Posted July 27, 2014 (edited) I guess that answers that then. Basically the planets are instantiated from this prefab structure (PSystemManager.Instance.systemPrefab), however it appears that none of the PQS data is included there. localSpace is created *after* we change this prefab. I guess we will have to wait for the PSystem to be spawned and add it in. So there is code for adding PQSMods (thanks everyone), but I haven't seen anything yet on creating the PQS component itself from scratch. Looking at in the Assembly Browser, seems pretty darn nasty... Edited July 27, 2014 by Teknoman117 Link to comment Share on other sites More sharing options...
KCreator Posted July 27, 2014 Share Posted July 27, 2014 Once you have the PQS created, its just a matter of setting its texture and adding PQSMods, both are relatively easy and I think this plugin's first useable beta can be pushed very soon!I think the shader that is mainly used is: Terrain/PQS/PQS Main - Optimisedwith some interesting values; _lowTex, _steepTex, _highTex and some other configurable blending variables...edit: My personal attempt at PQS to Jool is going OK, I just need to copy Kerbins texture, and that is causing some errors, once done. Ill put the code on github. Link to comment Share on other sites More sharing options...
aftokinito Posted July 28, 2014 Share Posted July 28, 2014 (edited) I guess that answers that then. Basically the planets are instantiated from this prefab structure (PSystemManager.Instance.systemPrefab), however it appears that none of the PQS data is included there. localSpace is created *after* we change this prefab. I guess we will have to wait for the PSystem to be spawned and add it in. So there is code for adding PQSMods (thanks everyone), but I haven't seen anything yet on creating the PQS component itself from scratch. Looking at in the Assembly Browser, seems pretty darn nasty...systemPrefab is a PSystem type variable that holds the PSystem that PSystemManager will spawn at PSystemSetup, they are not really instantiated but setup.Both localspace and scapedspace are created on PSystemManager.SetupLocalSpace and PSystemManager.SetScaledSpace respectively for the scene and PSystemManager.SetupLocal and PSystemManager.SetScaled respectively for each celestial body.As for the PQSMods, you just have to add the components to the game object of the celestial body you want to deform:PQSMod_VertexPlanet vertexP = myPlanet.celestialBody.gabeObject.AddComponent<PQSMod_VertexPlanet>(); Edited July 28, 2014 by aftokinito Link to comment Share on other sites More sharing options...
Teknoman117 Posted July 28, 2014 Share Posted July 28, 2014 (edited) Wait, do the PQSMods create the PQS parent object if it does not exist? If not, how many of its 100 parameters are controlled by the addition of PQSMods? (This is in the content of custom planet creation, not the modification of existing bodies)Also, the scaledVersion property of PSystemBody - how does its size get related to that of the represented body? I dumped the data related to Dres and Eeloo, and the size of the mesh attached to PSystemBody.scaledVersion.GetComponent<MeshFilter>() for both was about the same. I dumped the transforms in ScaledSpace, and the local scale transforms for both Eeloo and Dres were both set at 0,0,0. Edited July 28, 2014 by Teknoman117 Link to comment Share on other sites More sharing options...
NathanKell Posted July 28, 2014 Share Posted July 28, 2014 Uh, the way I've seen it done, and the way I do it, is to create a new empty gameobject, make it a child of the PQS, and add the PQSMod as a component to the empty gameobject.scaledVersion presumably points to the scaled space transform? That's a mesh, usually of ~1000 unit radius, but some moons are 100 unit radius. The mesh is (or darn well should be) warped so that it wraps to the PQS terrain. It is then scaled in its transform so that its vertices are v.magnitude = PQS.height * ScaledSpace.inverseScaleFactor (1/6000).Most code for dealing with that starts here in RSS. Link to comment Share on other sites More sharing options...
aftokinito Posted July 28, 2014 Share Posted July 28, 2014 Wait, do the PQSMods create the PQS parent object if it does not exist? If not, how many of its 100 parameters are controlled by the addition of PQSMods? (This is in the content of custom planet creation, not the modification of existing bodies)Also, the scaledVersion property of PSystemBody - how does its size get related to that of the represented body? I dumped the data related to Dres and Eeloo, and the size of the mesh attached to PSystemBody.scaledVersion.GetComponent<MeshFilter>() for both was about the same. I dumped the transforms in ScaledSpace, and the local scale transforms for both Eeloo and Dres were both set at 0,0,0.PQSMods are just components that modify the 489759354 variables PQS has in a human readable way.You first add the PQS component to your object and then add as many PQSMods as required that modify that PQS acordingly.PQS stands for Planet Quad Sphere and, as the name suggests, it is just a quad divided deformable sphere meant to be used for planet generation. Link to comment Share on other sites More sharing options...
Teknoman117 Posted July 28, 2014 Share Posted July 28, 2014 *sigh* - just spend the last two hours writing code that dumped all the damn variables in PQS to see what I should modify. I guess I'll pull apart KCreator's code and see if I can load the output of his terraform tool into a custom planet. Link to comment Share on other sites More sharing options...
aftokinito Posted July 28, 2014 Share Posted July 28, 2014 *sigh* - just spend the last two hours writing code that dumped all the damn variables in PQS to see what I should modify. I guess I'll pull apart KCreator's code and see if I can load the output of his terraform tool into a custom planet.Using KCreator's addon is indeed really useful to mess around with the PQSMods and see what they do.All you have to do then is copy the variables you used on those PQSMods and add them to your planet in code. Link to comment Share on other sites More sharing options...
Teknoman117 Posted July 28, 2014 Share Posted July 28, 2014 (edited) PQSMods are just components that modify the 489759354 variables PQS has in a human readable way.You first add the PQS component to your object and then add as many PQSMods as required that modify that PQS acordingly.PQS stands for Planet Quad Sphere and, as the name suggests, it is just a quad divided deformable sphere meant to be used for planet generation.I've familiar with quad trees and octrees (never used a quad sphere) ... So basically, in the PSystemReady event do the following right?// Create the PQSGameObject gameObject = new GameObject();gameObject.transform.parent = localSpace.transform.FindChild("Kopernicus");PQS controller = gameObject.AddComponent<PQS>();// Associate with the Kopernicus celestial body// ADD ALL THE MODS!!!GameObject mod = new GameObject();mod.transform.parent = gameObject.transform;PQSMod_something the_mod = mod.AddComponent<PQSMod_something>();Do the mods automatically find the PQS controller in the parent? Edited July 28, 2014 by Teknoman117 Link to comment Share on other sites More sharing options...
aftokinito Posted July 28, 2014 Share Posted July 28, 2014 I've familiar with quad trees and octrees (never used a quad sphere) ... So basically, in the PSystemReady event do the following right?// Create the PQSGameObject gameObject = new GameObject();gameObject.transform.parent = localSpace.transform.FindChild("Kopernicus");PQS controller = gameObject.AddComponent<PQS>();// Associate with the Kopernicus celestial body// ADD ALL THE MODS!!!GameObject mod = new GameObject();mod.transform.parent = gameObject.transform;PQSMod_something the_mod = mod.AddComponent<PQSMod_something>();Do the mods automatically find the PQS controller in the parent?There is no need to do the parent ballet, just do this:PQS pqs = PSystemManager.Instance.localBodies.Find("Kopernicus").gameObject.AddComponent<PQS>();The same applies for PQSMods and no, they don't find the PQS automatically, you have to point it using the "public PQS sphere" variable all the PQSMods inherit from PQSMod. Link to comment Share on other sites More sharing options...
NathanKell Posted July 28, 2014 Share Posted July 28, 2014 Set mod.sphere = thePQS.edit: ninja'd. Link to comment Share on other sites More sharing options...
Teknoman117 Posted July 29, 2014 Share Posted July 29, 2014 (edited) So I've hit a strange road block (not one I've had to deal with before). So in order to spawn planets as Squad does, we have to modify the systemPrefab and introduce our custom worlds. For some reason (I'm accusing the global state in PQS, possibly?), using Instantiate() on a PQS *OR* creating it from scratch with AddComponent<PQS>() causes some global state to break. However, if we assign the PQS prefab PSystemBody.pqsVersion to the prefab of another planet, the PSystemManager creates the planetary system successfully and the new world has its own PQS, albeit a copy of another world's. When we edit it when its live, nothing goes wrong. I've posted the error caused by attempting to create a PQS in the prefab here: https://github.com/BryceSchroeder/Kopernicus/issues/2.I think this is caused by some subtle difference between a prefab GameObject and a GameObject created in the game. The prefab game objects don't exist in the Unity3D render groups, and never receive events such as Update(). However using Instantiate makes this live. I found a function that creates a prefab from a GameObject, but it exists solely in the UnityEditor namespace, which isn't available in the game. Either way, allowing the PQS of the custom body to be created from an existing one has yielded a successful custom world though.- Nathaniel R. Lewis Edited July 29, 2014 by Teknoman117 Link to comment Share on other sites More sharing options...
medikohl Posted July 29, 2014 Share Posted July 29, 2014 Brief inquiry. Any idea if we will be able to incorporate missions and science with these new generated planets? Link to comment Share on other sites More sharing options...
BryceSchroeder Posted July 29, 2014 Author Share Posted July 29, 2014 Brief inquiry. Any idea if we will be able to incorporate missions and science with these new generated planets?Full Science / Career compatilibity is part of the basic goals for the mod, yes. Link to comment Share on other sites More sharing options...
SpannerMonkey(smce) Posted July 29, 2014 Share Posted July 29, 2014 Great work on this guys, nice work including us of the more mechanical leanings in the discussion, i know it's far to easy to say all this in pm's and gchat or whatever (guilty of this myself) rather than sharing the process and some thoughts, much appreciated Link to comment Share on other sites More sharing options...
medikohl Posted July 29, 2014 Share Posted July 29, 2014 As soon as this gets done I am making all types of tricky planets again Link to comment Share on other sites More sharing options...
Teknoman117 Posted July 30, 2014 Share Posted July 30, 2014 At least the archives don't break anymore with custom planets Link to comment Share on other sites More sharing options...
Recommended Posts