1. Solar Lander
  2. News
  3. Devlog #008: Craft Modding Implemented

Devlog #008: Craft Modding Implemented

[p]I took about a one-month break from game development, then returned a couple weeks ago and was able to basically knock-out the rest of what I needed to make fully-custom spacecraft entirely possible. So here is the basic process, as it currently stands, for making a fully-custom spacecraft.[/p][h2]Modeling[/h2][p]I used gmax to make the 2D craft models, following the original sprites as closely as possible to create some nice 2D vector graphics to replace the sprite graphics. The 2D vector graphics are essentially flat planes layered on top of each other. Then I used max2msh to export the model to an Orbiter mesh file (making sure that "Rotate 90 degrees" was turned off).[/p][p]Here are a couple of screenshots of the new, 2D vector graphics.[/p][p][/p][p]3D vector graphics are theoretically supported, but I haven't made any 3D models for the game yet.[/p][p]For the colliders, I created a text file using the msh file as inspiration to define the collider shapes. I currently do not have a convenient way to define the shapes in a modeling program, so they have to be defined by hand.[/p][p]Solar Lander will not be able to read Orbiter mesh files because it's going to have its own mesh format (and file extension). So I have to convert the msh files generated by max2msh. So I made a tool to do the conversion for me. Solar Lander Model files will support 2D and 3D meshes, as well as circle, box, and polygon colliders.[/p][p]The tool I made will take a msh file representing the 2D model, an optional msh file representing the 3D model, and an option text file representing the colliders. If everything is in order, it will produce a model file that can be used in the game. This tool has the limitation of not being able to make a scene graph for the model. I'm not quite sure yet how I will create a general-purpose tool that can make the a scene graph. That will have to come much later in development.[/p][p]For 2D geometry, the Z coordinate is used to control the layering. Positive X is right, and positive Y is up. In gmax, objects with a higher z coordinate will appear on top of objects with lower z coordinates. If you accidentally have "Rotate 90 degrees" turned on when you export the mesh, then all of the triangles will be compressed down to an infinitely-thin line.[/p][p]For 3D geometry the coordinate system is the same. Positive X is right, positive Y is up, and positive Z moves towards the camera. Note that the 3D geometry is purely visual. The physics will always be 2D. But there will be a setting to toggle between 2D and 3D graphics.[/p][p]Of course, needing max2msh is only intended to be a temporary solution until I can make my own exporter to export only the data that's relevant to Solar Lander. Though whatever is exported from the modeling program will still be a plain text file, so you can define the model easily by hand. But hopefully this intermediate file will not be an Orbiter msh file by the time the modding update goes live.[/p][h2]Texturing[/h2][p]Solar Lander will not support texturing the models. All model appearances are defined by solid colors.[/p][h2]Craft Properties[/h2][p]Originally, I was going to have craft properties defined by INI files. But due to the limitations of INI files, I decided to go with Json files instead. Spacecraft aren't the only things defined in Json files. Various vehicle components, such as thrusters and docking ports, can get their own Json files. The craft file can then reference these other files and the game will use them to assemble the final craft. These configuration files can also reference audio files for various effects, such as crashing.[/p][h2]Other Notes[/h2][p]One of the things I've implemented is a separation force for attachment points. This will push physics objects away from each other upon detachment from the superstructure. I've also discovered an interesting bug where a torque is introduced near the world origin and fixed it. This also had the effect of removing the torque of the lateral translation thrusters which I simply could not understand. I have also implemented a fix for the Physics Update, but the cause of this bug in the Physics Update wasn't just the one line of code that it was for the modding update.[/p][p]For the Modding Update, the reference line used to calculate the torque created by the linear force wasn't constructed correctly. And that was all that was causing the issue. The Physics Update also had the reference line constructed incorrectly. But also in the Physics Update, the craft's center of mass wasn't being updated properly after being separated from the superstructure. So the reference line fix wasn't sufficient to fix the issue with the lateral translation thrusters generating a torque on the craft.[/p][p]I have also been considering adding a raycast to the rockets that will apply a force to any vessel that is in the direct path of the rocket exhaust. I will have to test the performance on this though. If I decide to keep that in, I fully expect players to weaponize it in competitive multiplayer games.[/p][p]Also, in a previous devlog, I stated that there will be two mods: "SolarLander/BuiltIn" and "SolarLander/Base". I have since changed my mind. There will still be the "SolarLander/BuiltIn" mod, but there will not be a "SolarLander/Base" mod. Instead, there will be a "SolarLander/Example" mod that will serve both as an example and add some new content to the game. I also plan to make a workshop example mod which will open-up the workshop while also introducing some new content.[/p][h2]Next Steps[/h2][p]The next step is going to be to define a file for stage connection and separation setups, and to rework the flight computer into something a little bit more flexible. The flight computer needs a significant rework in order to be able to both (a) add more piloting assists, and (b) enable users to write their own programs. The flight computer also needs to be able to run multiple programs at the same time. Technically speaking, the current system can do this, but it's not really running discrete "programs".[/p][p]Also, as of the time this goes live, sound effects for the new modding system may or may not be fully-implemented. I'll be working on that if that is the case. One of the issues with audio is that Unity doesn't have any generic functions to load audio at runtime. All of the asset loading functions that Unity does have want them to be located in a specific folder, which is incompatible with Solar Lander's modding system.[/p][p]Also, pretty much every logo on the store and library page will need to be updated to reflect the changes being made to the game. Currently, it's just showing the sprite graphics. But when the Modding Update goes live, I will want this to show the new 2D vector graphics.[/p]