starstrider42 / custom-asteroids Goto Github PK
View Code? Open in Web Editor NEWA KSP mod that lets users control where asteroids appear
Home Page: http://starstrider42.github.io/Custom-Asteroids/
License: MIT License
A KSP mod that lets users control where asteroids appear
Home Page: http://starstrider42.github.io/Custom-Asteroids/
License: MIT License
kubi reports that when running Custom Asteroids with only one asteroid group, where that group has a spawnMax
field, the game will spam warnings that no asteroids have nonzero weight. Fix the spawning logic to only report an error if no asteroid group has nonzero base weight.
When starting a new game with the default asteroid configuration, the first asteroid is always named HSJ-227, and is always placed into the following orbit:
ORBIT
{
SMA = 30538612101.3155
ECC = 0.136886541924265
INC = 6.05229021995948
LPE = 146.525451660156
LAN = 156.887023925781
MNA = 278.716278076172
EPH = 0.04
REF = 0
}
I believe this is a problem with KSP's stock random number generator, so it may not be worth the trouble of working around.
Update May 10: the issue has now spread to standardizing the first two asteroids that are spawned.
The following config block:
INTERCEPT
{
name = groupB
title = Paired <<1>>
spawnRate = 1.0
targetBody = Duna
approach
{
type = ImpactParameter
max = Ratio(Duna.soi, 0.5)
}
warnTime
{
dist = Uniform
min = Ratio(Duna.psol, 50)
max = Ratio(Duna.psol, 220)
}
}
will not load in Custom Asteroids, giving the following error:
Celestial body 'Duna' does not have a solar day.
The culprit is the CelestialBody.solarRotationPeriod
property, which I assumed indicates that a celestial body has a well-defined solar day (i.e., is not the Sun or a tidally locked planet) but, in the stock game, is set only for Kerbin. Fix the code so that psol
returns the correct solar day for both non-Kerbin planets and moons.
For players who want to change the rules, I might provide an API to let them decide when (and where?) new asteroids appear.
Prerequisite: issue #5 solved.
Relevant mods: CactEye, Asteroid Day
Custom Asteroids never creates asteroids when Custom Barn Kit is installed. The root cause appears to be the absence of GameVariables.Instance
. Presumably CBK deletes it and replaces it with something else...
Really an extension of #4, this would allow some asteroid groups to have bigger asteroids than others
Needs to be recompiled against 1.0.5 - I really want to use this mod again!!!
Currently, the OrbitPhase
block can be given as either mean anomaly or mean longitude. However, this makes it hard to control the discovery phase of an object if it has a range of eccentricities, especially if those eccentricities are close to 1 (either eccentric or hyperbolic).
KSP's stock comets constrain the discovery phase as the radius at which the comet is first detected. It would be useful if OrbitPhase
had a similar capability, with the user able to give a minimum or maximum allowed radius (this would, of course, need to be validated against the orbital apses). I'm not sure how the user should distinguish between incoming and outgoing phases.
Another useful parametrization for OrbitPhase
would be as an absolute time. This would have no ambiguity, since it could follow the mean anomaly convention of negative values for phases before periapsis and positive values for after.
With the addition of new config options in 1.3, the existing documentation for Custom Asteroids' config format has become too hard to navigate and read. It should be rewritten to be more user-friendly, including the following changes:
darkside suggested that being able to express asteroid orbital elements relative to a plane other than KSP's native coordinate system might improve compatibility with RSS.
This would require a way to transform inclination and longitude of ascending node from the skewed coordinate system to KSP's native coordinates. Argument of periapsis and mean anomaly are invariant under the coordinate change, but longitude of periapsis and mean longitude would need to be converted into standard orbital elements while in the skewed frame.
Thesonicgalaxy has suggested including some in-game feedback for bad configs in addition to the current logging process.
When a comet is created using Custom Asteroids, the log emits [ProtoVessel]: Unable to create Comet VFX.
immediately afterward. The comet does not show a coma and tail in the tracking station until at least one scene change since the comet appeared. Track down the error and ensure that comets are correctly displayed right away.
To Reproduce
Steps to reproduce the behavior:
When using the custom spawner, asteroids do not get removed from the game and just pile up. This bug does not occur with the stock spawner, though that may be because it sets the spawn rate based on the number of untracked asteroids.
In an effort to avoid a bug where asteroids spawn until the game chokes, I've disabled the CustomAsteroids spawner in favor of the stock one.
While this did fix the number of asteroids I have, all new asteroids are just named 'Ast. FOO' instead of the titles listed in the config files.
Asteroids are sometimes removed when switching between flight mode and the KSC. The bug appears to only affect asteroids that have been visited and renamed, and strikes when setting either the asteroid or a nearby spacecraft as the active vessel then immediately exiting to KSC. The bug occurs on both KSP 1.3.0 and 1.3.1.
I don't know how the @ref
syntax works, or I'd submit a PR.
Please describe the problem, including detailed steps to reproduce it.
Every asteroid (and some moons) are having a serious stroke, even on the map screen, the 'roids don't move, but are rotating at break-neck speeds including my kerbal in EVA. I've tried timewarp, but it didn't work. I've heard that this is a vanilla bug, but I haven't been able to reproduce it at all, so I don't know whats wrong here. Side-note: small moons (including dres) are out of orbit, wtf? (maybe i should clarify its out of the set orbit path, like this: / )
/
O
\
#4 was resolved without making the new asteroid classes visually distinct. Because asteroids are generated procedurally using a PQS mesh, standard part modelling techniques will not suffice.
Edit: old discussion on this subject: http://forum.kerbalspaceprogram.com/index.php?/topic/68266-/&do=findComment&comment=1167867
From daniel l. in the forums:
Is it possible to make asteroid clusters that the game views as a single entity? As in spawning a group of asteroids and creating invisible part connections between them so the game see's them as one.
When an asteroid is loaded in physics range, it loses its DiscoveryLevels.Name flag. Possibly related to #10.
Update: cannot reproduce this bug at present. Will keep issue open in case it reoccurs.
This would allow RSS compatibility, as well as Trojan asteroid and long-period comet populations.
Being able to replace semimajor axis with periapsis or apoapsis, or mean anomaly with phase angle, would allow patterns that are otherwise impossible.
Jetski requested that it be possible for a group to create only one asteroid. After some discussion, we agreed that the limit need only apply to the number of asteroids currently spawned; there's no need to permanently disable a group once the limit is reached.
Implementation will require tracking which asteroids belong to which group, something Custom Asteroids currently ignores. This can be easily piggybacked on the extra code being written for #4.
Obligatory using 1.9.x version on 1.10.1
But no astroids have spawned in almost two ingame years of testing.
Most of the time, when an asteroid group is given with a orbitPhase->MeanLongitude constraint, the asteroid appears at the requested longitude. However, around 1/6 of the time, the asteroid appears in the wrong place. This is shown in the screenshot below, which shows a run of the Mean Longitude test case.
Asteroids circled in green are correctly placed. Asteroids in red are incorrectly placed, with an arrow pointing to where they are supposed to be.
To reproduce:
test.cfg
file at https://gist.github.com/Starstrider42/429a770c4e64631b5acf in the CustomAsteroids/config directory, removing any other files present.output_log.txt
and persistent.sfs
for the run in the screenshot are provided at https://gist.github.com/Starstrider42/429a770c4e64631b5acf. The file testlog.csv
has a data dump of all the asteroids and their orbital elements, together with the quality of the placement: "BAD" represents the two asteroids circled in red in the screenshot, while "Marginal" indicates asteroids that are almost, but not quite, where they should be.
Save file editing proves that the problem is with the sign of the mean anomaly for these cases. However, I have not been able to find a correlation between the bug and any of the orbital elements, or any combination of them, including combinations used in choosing the sign.
If a player uses MaximumWarp to play the game at 1,000,000× and 10,000,000×, the asteroid counts will be unable to reach a steady state. Asteroids will only be cleaned up every 170 days or 4.7 years of game time, respectively, which means a LOT of asteroids right before cleanup.
KSP 1.10 adds comets to the stock game. Custom Asteroids should be able to generate such comets itself, replacing the asteroids-on-cometary-orbits approach of previous versions.
Specific requirements:
oort
and innerComets
groups (which roughly correspond to long- and intermediate-period comets in the new system).
COMET_ORBIT_TYPE
configs.
ModuleComet
and CometVessel
almost certainly depend on these blocks, so they must be used at least for comets' physical properties.PotatoComet
that would not be a drop-in replacement for the real thing (different modules). This seems like more trouble than it's worth.I've found a weird bug that slipped through my testing of inclined asteroid groups. All behaviour in this post was tested by replacing the Custom Asteroids config that ships with RSS with this file.
If I load KSP and start a new game, asteroids will be aligned with the orbital planes of the RSS. Edge-on view:
Oblique view:
However, if I either:
then newly spawned asteroids will no longer have the correct orbital orientation, so long as I spawned at least one asteroid. Sometimes the effect is a few degrees, sometimes it's dozens. Oblique view of a bad case:
Within a KSP session and for a single save game, the orbital orientation does not change. I've yet to find a way of predicting the size of the offset; I used to think it increased with the number of asteroids spawned previously, but that's not the case. The rotation does not appear to be around a special axis.
The orbit rotations done by CustomAsteroidPlanes
are implemented by finding the asteroid's untransformed state vectors (using Orbit.getRelativePositionAtUT(ut)
and Orbit.getOrbitalVelocityAtUT(ut)
), left-multiplying them by a Quaternion
, and calling Orbit.UpdateFromStateVectors
with the altered vectors. I've added some debugging logs, and the transformer swears it's always doing the same transformation, regardless of what the map view looks like:
Calibration: [0, 0, 1] -> [0.026371156796813, -0.390285193920136, 0.920316278934479]
Calibration: [1, 0, 0] -> [0.999589502811432, -1.84732489287853E-05, -0.0286505203694105]
Calibration: [0, 1, 0] -> [0.0111988745629787, 0.92069399356842, 0.390124499797821]
When a save game is first loaded and the FixedRateSpawner
boots up, it thinks it is UT 0. This causes the spawner to quickly recreate all asteroids that would have spawned between UT 0 and the true in-game date. While these asteroids get cleaned up (they're mistaken for stock-spawned asteroids), this slows down game loading. Note that this bug only happens when a save game is loaded, not during scene changes.
Unfortunately, a naive fix to this problem runs into a much worse bug, where each scene change resets the Unity random number generator to a fixed value (related to #1?). The result is that identical asteroids are produced after each scene change. This doesn't seem to happen when Custom Asteroids is not installed or when FixedRateSpawner
is allowed to spam asteroids, for reasons unknown.
jonassm requested that asteroids be able to have different orbit colors.
As far as I know, orbit color cannot be statically configured for a vessel, but the orbit color can be edited on the fly. It might be possible to implement custom colors by storing the color in a CustomAsteroidData
and editing each asteroid at scene change time.
The Sentinel Telescope appears to be implemented as an asteroid spawner independent of the ARM spawner. This means that currently Custom Asteroids neither disables nor modifies its behavior.
The Sentinel Spawner should be modified or replaced to let the telescope create Custom Asteroids-controlled asteroids. Exact behavior is TBD.
dprostock reported that ore drills do not work if Custom Asteroids is installed. Attempts to reproduce led to the discovery that the drilling code (and only the drilling code) crashes if the asteroid has a ModuleAsteroidResource
block with unknown resources.
To Reproduce
Steps to reproduce the behavior:
Start a sandbox game of KSP
Run time forward until asteroids spawn
Create a ship equipped with an Advanced Grabbing Unit, a stock ore drill, and an ore storage tank
Launch the ship, press Alt+F12, select "Cheats/Set Orbit" from the menu, and select a rendezvous with an asteroid
Dock with the asteroid, deploy the drill, and tell it to start harvesting.
The drill runs, but no ore is mined, nor does the drill heat up. The log is filled with messages like:
[ERR 14:06:12.749] [RESOURCES] - Error in - BaseConverter_GetDeltaTime - System.NullReferenceException: Object reference not set to an instance of an object
at ModuleAsteroidDrill.PrepareRecipe (System.Double deltaTime) [0x0038d] in <55ba45dc3a43403382024deac8dcd0be>:0
at BaseConverter.GetBestDeltaTime (System.Double deltaTime) [0x00000] in <55ba45dc3a43403382024deac8dcd0be>:0
at BaseConverter.GetDeltaTime () [0x000d5] in <55ba45dc3a43403382024deac8dcd0be>:0
Investigate whether Custom Asteroids can or should include localization features. Possibilities include:
Currently, most orbital parameters in Custom Asteroid configs must be either floating-point literals, a Ratio
expression, or a Offset
expression. The latter two are both counterintuitive and inflexible; it would be more useful to replace them with syntax similar to everyday mathematical expressions.
The new syntax should allow numerical parameters to be an Expression
, defined as one of the following:
<planet>.<value>
Resonance(<planet>, <m>:<n>)
(Expression)
-Expression
Expression [+|-|*|/] Expression
Drew Kerman posted an intermittent bug showing NullReferenceExceptions in the log during asteroid spawns in timewarp. Another player, N3N, reported the same problem but said that reinstalling some (unspecified) third-party mods fixed it.
I cannot reproduce this bug on a clean game of KSP; given this and N3N's report, it is likely a mod conflict of some sort.
Loading mod settings with KSP's built-in mechanism rather than manually will allow ModuleManager users to tweak settings for specific mods.
Since Custom Asteroids 1.3.1 was released, CRP has added the following resources to asteroids:
Per-class distributions for these resources should be added to the next CA release.
If I could find a way to set it, I could control the rate (say, in asteroids/day) at which asteroids spawn. This would make it easier for other players to add new asteroid groups, and would be a nice customization option anyway for players who feel the stock rate is too high (or too low, but I kind of doubt that).
zilfondel reported the following log error (copied from http://forum.kerbalspaceprogram.com/index.php?/topic/72785-/&page=6#comment-1816129):
Hi, I am receiving this error message periodically while on maximum timewarp, which is ~10,000x and above due to the Time Control mod.
CustomAsteroids: Could not place Ast. TZC-416. Cause: "CustomAsteroids: Selected invalid population kboNonResonant"
Root Cause: "Culture name r is not supported.
Parameter name: name"These errors typically come in packs of 3 at the same time, but not always. Note that I do not have the tracking station unlocked.
KSP x64 (Linux)
Mods: SETI, Outer Planets Mod, Keptunian Objects, EVE, Better Atmospheres, Time Control, etc.
Possibly related to #16.
Basically one asteroid will spawn in an entire save, and it's type, orbit, and designation is always the same. I'm using x64, by the way.
Currently, there is no way to determine the object class (roughly spectral type) of an asteroid short of visiting it.
However, for comets the CometVessel
module can override the knowledge base entry, displaying information about the comet's orbit instead of its size, and it seems like the purpose of VesselModule
is to be accessible from unloaded contexts like the tracking station. Create a VesselModule
that displays the asteroid's class, and add it to asteroids (but not comets?).
With the addition of Magic Boulders to asteroid code in 1.1.3, any asteroid can potentially be bouldered. The cleanest way for Custom Asteroids to support this is to make magic boulders a separate asteroid class, then emulate the stock occurrence rate.
DEFAULT
blocks have been deprecated; they should be removed in the next breaking version.
kubi reports that if an asteroid group has the spawnMax
field, it limits the total number of asteroids that will appear per scene change, even if they are allowed to go untracked and disappear. The limit should apply to the total number of tracked and untracked asteroids that exist at a given moment.
Seeing asteroids spawning with the same name in the exact same orbit and position as they did days or weeks ago. I have 3 different save files for various purposes and I pull asteroids out of each of them into a separate save, so it's reasonable to think that maybe different saves would generate asteroids of the same name but unless the orbital properties are determined based on the name it's a bit weird to see the exact same orbit show up as well. Some asteroids that have the same name are of a different group (KBO vs. Trojan, for example) so in that case their orbits are different. The stock "Ast." group does also produce duplicate names at time but no where near the frequency of the Custom Asteroid groups.
Not sure what to tweak in the SFS or CA config to play around and see how the spawning behavior changes over time.
Geschosskopf has reported some problems in debugging configs with vague error messages: http://forum.kerbalspaceprogram.com/index.php?/topic/72785-11x-custom-asteroids-131-may-7/&do=findComment&comment=2688063
In the absence of specific criteria to reproduce, I should carefully review all exception messages to find ones that haven't been updated...
Consider adding a Custom Asteroids KSPEdia page. While the basic population mechanic probably doesn't need player-oriented documentation, a summary of in-game effects of asteroid types would be useful. I'm not sure whether asteroid resource abundances should be spelled out in-game, or left as something for players to discover.
Asteroids from different populations could have different classes (stoney, carbonaceous, icy, etc.). At the most basic level, this could just be a different model. At more advanced levels, it could affect science options, or have an impact on mining mods such as Kethane, Extraplanetary Launchpads, or Interstellar.
When a vessel undocks from an asteroid, the resulting asteroid has a blank name and an incorrect seed and prefabBaseURL. In addition, the vessel that undocks has a phantom asteroid part; when the vessel is next loaded, it will appear embedded inside an asteroid.
This bug does not occur with stock 0.23.5.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.