Jump to content

Majiir

Members
  • Posts

    1,269
  • Joined

  • Last visited

Everything posted by Majiir

  1. Update released for 0.24 compatibility. Release notes to follow shortly.
  2. Unfortunately, I'm not expecting to have KAS ready until a day or two after 0.24 is released. I'll be able to speak about the details once the update hits.
  3. We can already do this in English and other languages. What makes you think Korean or Japanese fans are more likely to make intentionally bad translations than French or German fans? Moreover: who cares? There are all kinds of awful or illegal things you could mod into KSP, and yet we don't see that happening. This is a bogus argument.
  4. Here's CompatibilityChecker version 3. It's a small update to add support for Unity version checking. This feature might be removed at a later date based on feedback and whether it turns out to be useful after the KSP 0.24 release. Remember: Only the latest installed version of CompatibilityChecker will run, even if that version comes with a mod that's compatible, so it's not crucial that you update. /** * Copyright (c) 2014, Majiir * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials provided * with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using UnityEngine; /*-----------------------------------------*\ | SUBSTITUTE YOUR MOD'S NAMESPACE HERE. | \*-----------------------------------------*/ namespace Compatibility { /** * This utility displays a warning with a list of mods that determine themselves * to be incompatible with the current running version of Kerbal Space Program. * * See this forum thread for details: * http://forum.kerbalspaceprogram.com/threads/65395-Voluntarily-Locking-Plugins-to-a-Particular-KSP-Version */ [KSPAddon(KSPAddon.Startup.Instantly, true)] internal class CompatibilityChecker : MonoBehaviour { public static bool IsCompatible() { /*-----------------------------------------------*\ | BEGIN IMPLEMENTATION-SPECIFIC EDITS HERE. | \*-----------------------------------------------*/ // TODO: Implement your own compatibility check. // // If you want to disable some behavior when incompatible, other parts of the plugin // should query this method: // // if (!CompatibilityChecker.IsCompatible()) { // ...disable some features... // } // // Even if you don't lock down functionality, you should return true if your users // can expect a future update to be available. // return false; /*-----------------------------------------------*\ | IMPLEMENTERS SHOULD NOT EDIT BEYOND THIS POINT! | \*-----------------------------------------------*/ } public static bool IsUnityCompatible() { /*-----------------------------------------------*\ | BEGIN IMPLEMENTATION-SPECIFIC EDITS HERE. | \*-----------------------------------------------*/ // TODO: Implement your own Unity compatibility check. // return false; /*-----------------------------------------------*\ | IMPLEMENTERS SHOULD NOT EDIT BEYOND THIS POINT! | \*-----------------------------------------------*/ } // Version of the compatibility checker itself. private static int _version = 3; public void Start() { // Checkers are identified by the type name and version field name. FieldInfo[] fields = getAllTypes() .Where(t => t.Name == "CompatibilityChecker") .Select(t => t.GetField("_version", BindingFlags.Static | BindingFlags.NonPublic)) .Where(f => f != null) .Where(f => f.FieldType == typeof(int)) .ToArray(); // Let the latest version of the checker execute. if (_version != fields.Max(f => (int)f.GetValue(null))) { return; } Debug.Log(String.Format("[CompatibilityChecker] Running checker version {0} from '{1}'", _version, Assembly.GetExecutingAssembly().GetName().Name)); // Other checkers will see this version and not run. // This accomplishes the same as an explicit "ran" flag with fewer moving parts. _version = int.MaxValue; // A mod is incompatible if its compatibility checker has an IsCompatible method which returns false. String[] incompatible = fields .Select(f => f.DeclaringType.GetMethod("IsCompatible", Type.EmptyTypes)) .Where(m => m.IsStatic) .Where(m => m.ReturnType == typeof(bool)) .Where(m => { try { return !(bool)m.Invoke(null, new object[0]); } catch (Exception e) { // If a mod throws an exception from IsCompatible, it's not compatible. Debug.LogWarning(String.Format("[CompatibilityChecker] Exception while invoking IsCompatible() from '{0}':\n\n{1}", m.DeclaringType.Assembly.GetName().Name, e)); return true; } }) .Select(m => m.DeclaringType.Assembly.GetName().Name) .ToArray(); // A mod is incompatible with Unity if its compatibility checker has an IsUnityCompatible method which returns false. String[] incompatibleUnity = fields .Select(f => f.DeclaringType.GetMethod("IsUnityCompatible", Type.EmptyTypes)) .Where(m => m != null) // Mods without IsUnityCompatible() are assumed to be compatible. .Where(m => m.IsStatic) .Where(m => m.ReturnType == typeof(bool)) .Where(m => { try { return !(bool)m.Invoke(null, new object[0]); } catch (Exception e) { // If a mod throws an exception from IsUnityCompatible, it's not compatible. Debug.LogWarning(String.Format("[CompatibilityChecker] Exception while invoking IsUnityCompatible() from '{0}':\n\n{1}", m.DeclaringType.Assembly.GetName().Name, e)); return true; } }) .Select(m => m.DeclaringType.Assembly.GetName().Name) .ToArray(); Array.Sort(incompatible); Array.Sort(incompatibleUnity); String message = "Some installed mods may be incompatible with this version of Kerbal Space Program. Features may be broken or disabled. Please check for updates to the listed mods."; if (incompatible.Length > 0) { Debug.LogWarning("[CompatibilityChecker] Incompatible mods detected: " + String.Join(", ", incompatible)); message += String.Format("\n\nThese mods are incompatible with KSP {0}.{1}.{2}:\n\n", Versioning.version_major, Versioning.version_minor, Versioning.Revision); message += String.Join("\n", incompatible); } if (incompatibleUnity.Length > 0) { Debug.LogWarning("[CompatibilityChecker] Incompatible mods (Unity) detected: " + String.Join(", ", incompatibleUnity)); message += String.Format("\n\nThese mods are incompatible with Unity {0}:\n\n", Application.unityVersion); message += String.Join("\n", incompatibleUnity); } if ((incompatible.Length > 0) || (incompatibleUnity.Length > 0)) { PopupDialog.SpawnPopupDialog("Incompatible Mods Detected", message, "OK", true, HighLogic.Skin); } } private static IEnumerable<Type> getAllTypes() { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { Type[] types; try { types = assembly.GetTypes(); } catch (Exception) { types = Type.EmptyTypes; } foreach (var type in types) { yield return type; } } } } } Example implementation of the (required) KSP version compatibility check: public static bool IsCompatible() { const int compatibleMajor = 0; const int compatibleMinor = 23; const int compatibleRevision = 5; return (Versioning.version_major == compatibleMajor) && (Versioning.version_minor == compatibleMinor) && (Versioning.Revision == compatibleRevision); } Example implementation of the (optional) Unity version compatibility check: public static bool IsUnityCompatible() { return Application.unityVersion == "4.3.3f1"; }
  5. Day 3: The other teams still haven't figured out that the final challenge is patience.
  6. I've reworked the Kethane converters to make the fuel ratios more natural and to provide economic incentive. Each converter will produce some byproduct, which is stored if you have space for it or vented if you don't. The heavy converter, for example, will produce rocket fuel in the same proportion as engines consume it, and there will be a small amount (under 1% by mass) of XenonGas byproduct. If you plan ahead and bring empty tanks on your mission, you could accumulate quite a bit of wealth.
  7. You could do this with Kethane by defining a custom resource generator that uniformly places your desired resource all over the planet. Then you can let Kethane's drill logic handle ground detection. There are a few features not yet implemented which could come in handy, like support for infinite resources in a deposit, but you could work around that by setting a very high starting quantity.
  8. While defining a mod set (a list of mods everyone should go download) is fine, and very useful for multiplayer, mod packs (redistributing those mods in a single package) are problematic. (I should note that neither Kethane nor KAS may be redistributed.)
  9. I was busy all week and wasn't able to contribute to my team, but I had a great time looking through the submissions. The captions were particularly fun to read. Looking forward to the final challenge.
  10. According to the ModStatistics database, the average time between session starts is 12 hours, 48 minutes (so about twice a day). The average session lasts one hour, 44 minutes.
  11. For the curious, these are the current place value totals (lower is better): Crotchety Old Modders: 3 Team Jedi: 4 I Think We Broke It: 5 Kerb-O-Nautix: 2 Shock Diamond: 4 Team clown_baby: 6 How does this work? How are "points" obtained? Does this mean that, for example, Kerb-O-Nautix could be eliminated despite having placed first twice in a row? I'm hoping that success in the second challenge will count for something substantial. (It's not easy for a team of modders to survive a stock challenge!) I'm not sure you're using that term correctly.
  12. A few metastatistics: There are 39,242 reports in the database, weighing in at 542 megabytes. That's not a ton of data, but it's enough that the mod listing query takes way too long to run. This is because it clusters all the different plugins it detects into mod names. (For example, Kethane.dll and KethaneToolbar.dll are both considered "Kethane".) The clustering query works fine for a few hundred reports, but it wasn't built to scale. At this point, none of the queries are particularly scalable. So, I need to spend some time working out which statistics will be computed and then build more efficient queries for all of them. This will involve a lot of precomputation. For example, if I wanted to query how many times people have launched KSP in the last month, I might have a precomputed stat for each day, sum up those days, and then add in the remaining reports since the last 24-hour checkpoint. This is certainly computationally faster, but it reduces flexibility, and that slows development. I'm still experimenting with different queries, so the site isn't progressing much at the moment. If you'd like to help, you could always help with the site. If you're not a coder, it would be great to hear what kinds of statistics you'd like to see, how you'd like to be able to filter and match them, et cetera. One thing I don't lack is data; it's coming in steadily and we've found some interesting patterns in the crash data. (The crash stat is also potentially flawed, but that's not certain yet.) While the server is struggling a little with inefficient queries, it seems to be handling the network traffic just fine, so I have no concerns about increasing coverage. I don't expect to see stability issues before ModStats hits 100K users.
  13. How is Kethane broken? It seems there's some dispute over this, but more importantly, there is no good information about what's broken. This list isn't helpful if it lacks detail and accuracy.
  14. It does no harm to delete the GameData/Kethane/ModStatistics folder as was mentioned in the other thread
  15. Please keep ModStatistics-related discussion in the ModStatistics thread.
  16. This is normal, and it will work fine with both. If you want, you can safely remove the one in the Kethane folder.
  17. Crotchety Old Modders: ferram4 Majiir NathanKell r4m0n
  18. ModStatistics 1.0.2 has been released. The download link in the first post has been updated. This update has further fixes based on feedback in this thread and elsewhere. I've also included the changelog for 1.0.1, since I never got around to updating the thread with that download. This update has been pushed through the auto-updater, so it's not strictly necessary to update the version packaged with your mods. Changes in this version: At startup, the user is prompted for their auto-update preference. 64-bit KSP is now detected and reported. Mac OSX is now correctly detected. Fixed output log spam when some assemblies couldn't be read properly. Changes in 1.0.1: Platform type (Windows, Linux, etc.) is now reported. Fixed a critical issue which caused most reports to fail with an error. Fixed an issue where the user agent wasn't properly set.
  19. Sorry about that; seems I forgot to push after the last release. My KAS repository on Github is now up-to-date. 64-bit portability usually deals with pointer types, which aren't present in fully managed code. If Unity somehow changed its geometric functions with the 64-bit version, that's a Unity bug and inconsistency that's not documented as far as I know. It's certainly not necessary for 64-bit compatibility.
  20. Not from the KAS side. The KAS plugin is fully managed code. It's agnostic to CPU word size. In other words, KAS doesn't have anything to fix; it would run just as well on a hypothetical 128-bit architecture. If 64-bit KSP is causing issues with KAS, that means there's either a bug in 64-bit KSP/Unity (highly likely) or a bug in 32-bit KSP that KAS is inadvertently depending on (less likely). If you can dig up more information that shows certain KSP/Unity functions are unreliable in 64-bit, it might be possible to pick alternatives, but my guess is not.
  21. I'd like to point out it's difficult to know what "average" is without data. Drop ModStatistics in your mod's folder. It will report that there's a plugin with a path like GameData/YourMod/ModStatistics/ModStatistics.dll. The server will filter out the ModStatistics part and figure it's named YourMod. There may be future improvements to better identify parts, but it should work for now. The data is quite skewed at the moment. I don't know of any mods aside from Kethane that have distributed the plugin. I might include a little note explaining that this doesn't really mean anything, but I'd like to keep it visible because it provides a baseline. It was bugged, so those pages weren't useful. I need to rewrite a few queries to support the larger volume of reports coming in, so the analysis might stay as-is for a few days. There comes a point where authors need to pick sane naming schemes. ModStatistics can handle GameData paths like /Author/Mod/Plugin.dll, /Author/Mod/Plugins/Plugin.dll, /Mod/Plugin.dll, /Mod/Plugins/Plugin.dll, /Plugin.dll, and maybe a few others. It can't handle Mod/Author/Plugin.dll (because that makes no sense). For what you described, it would decide the mods are named "Utility" and "Parts" but you've picked a very unusual way of structuring things. Even /Author/Mod/Plugins can be hard to detect because the server needs knowledge of at least two mods from the same author to work out that the author isn't the name of the mod.
  22. Kethane flows like monopropellant. It doesn't need a connection as long as it's on the same vessel.
×
×
  • Create New...