-
Posts
202 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by Neomatt
-
Just replying on that: it may not be an overnight patch. Granted, the gain is so big it would be hard not to switch to Unity4, but maybe the code cannot be ported as a simple recompilation. Anyway, when it's out, I'm sure HarvesteR will try to port KSP on it.
-
"at a time between one second and the end of the Universe. Or maybe not."
-
ok what is wrong with my code?
Neomatt replied to seannybgoode's topic in KSP1 C# Plugin Development Help and Support
There are a few there: http://kspwiki.nexisonline.net/wiki/Module_code_examples But for the "not a Part" thing, I'm not sure it's possible to do right now. What was new in 0.15 is the PartModule class (lots of details here: http://kerbalspaceprogram.com/forum/showthread.php/10296-0-15-code-update-PartModule-KSPField-KSPEvent-ConfigNode-and-PartResource), but even with this, you still need to add your code via a part (or edit the .cfg of an existing one). From what I got from the code above, you're trying to control engines; those are the parts you should extend (or create your own). As for this.vessel, well, if your class is not inherited from Part, and doesn't have "Vessel vessel = (code to define the vessel)" in it, sure, this.vessel doesn't work, since it's not defined in your class. The keyword "this" means that it's the current instance of a class; you could have a Part A (decoupler) and a Part B (engine) at the same time, both parts, but if your code says "this.vessel", A and B will each look their own value for vessel. Anyway, I'm pretty sure you'll have to use Part or PartModule; even MechJeb still uses a part (and it's one of the biggest plug-in out there). -
ok what is wrong with my code?
Neomatt replied to seannybgoode's topic in KSP1 C# Plugin Development Help and Support
No no, it's just like Java; classes attributes are accessed the "object.attribute", like vessel.id. There are a few things I noticed though: - your EngineControls class does not inherit from Part or PartModule; that's necessary for a part (and it's important to get the part's vessel). - the Part class has a few attributes you inherit: "parent" (another Part), "vessel" (a Vessel instance, containing a list of parts), and other stuff. When I said to use "vessel.active" instead of "Vessel.active", it means using the instance attribute "this.vessel.active" (is the vessel in which my part is right now active?) instead of the static attribute Vessel.active (which doesn't know which instance is calling). Class vs. instance is the same in Java; one is the definition (Class, Caps "title"), the other is the instantiated object from this class (instance, no caps, linked to your object). -
ok what is wrong with my code?
Neomatt replied to seannybgoode's topic in KSP1 C# Plugin Development Help and Support
Simple: you're using Vessel, not "vessel" (no caps). Vessel is the class, vessel (or this.vessel) is the instance of the class. -
http://en.wikipedia.org/wiki/N-body_problem ? Okay, if planets/moons stay on rails, it becomes more of a "how different bodies interact with one ship", so the problem is kinda moot. But I'm not sure how CPU-intensive planning a trajectory (with all bodies having different attraction at different points in time) could be.
-
Sounds like a file is missing. Do you have the .dll directly in KSP_win/plugins (no folder)? Did you put the sounds in the main "sounds" folder?
-
Whoops, I missed that one when I searched for previous explosive plug-ins. Sorry. And I did see your PM, I'm responding when I have time (in French probably, since we are both).
-
Two issues with that: one, it's 5 seconds (but I could do a 5...4...3...), and two, the duration is variable. So, you could have "5...4...BOOM". I'm not saying no, but I do like the beeps. I did a 0.3.1 with the beepbeep sound, and I like how parts travelling far (especially the C4) are just beeping like explosive Sputniks. I also improved the GUI a bit for remotes; now, it appears/disappears only when a pack can be exploded (i.e. is decoupled). edit: hmm, it seems to have some issues with multiple packs (GUI stays/disappears). I'll double-check on that. Otherwise, anybody got an idea on how to do a "Jeb goes to an existing debris and adds a C4 pack"? I can imagine how the "add a pack to the debris" part should work, but for him to carry it/place it, I'm not sure how it could work,
-
New release, with remote-triggered C4 packs, new textures, etc. When in doubt... Also, I cleaned up the code a lot, since it was needed for the remote packs. Next step (today maybe?): finally do the countdown sound for the timed pack, and maybe a quick beepbeepbeep for both packs just before detonation.
-
Okay, I did a few tests with the Kosmos pack; it exploded each time. However, I noticed something important that may explain the "I didn't see the explosion, it just disappeared"; when the explosion... explodes, it is fixed at a point in space, with no velocity. That means that if you're going at 3000m/s and the explosions takes 0.5s to go from start to finish, you're going to look at it when it's at 10m (start of explosion, you just decoupled) to 1510m (when it's ended) in half a second. It creates a quick "fwwt" explosion that can be easily missed, except if you change focuses on the discarded part before it exploded. Since it's how explosions work (both IRL and in KSP) and that the exploding part depends on SQUAD, I wouldn't call it a bug per se. You can always try the new pack, put 3-4 more TNT packs, and change the .cfg to want 1 explosion per tick; that will create a quick sequence of explosions, but always "near" you (since the not-yet-exploded packs will travel around your speed).
-
Okay, I'll try out the Kosmos pack tonight. Maybe it's not compatible in some way with my pack. Oops, .zip takes 1 'p'. Fixed.
-
v0.2 is here, with only the new bigger explosions. Limit of packs is 16 per vessel (you can put more, but they won't explode), and they blow by group of 4 with a 100ms delay. I know I put more before, but sometimes it crashed hard. So, to be safe, those are the values (you can change both of them in the .cfg if you want to try). Next step: countdown sound. Then this week-end, I may try to make a GUI for remote explosives.
-
On the engine? Is it on the rocket when you get up? Doesn't it melt? Maybe I'm missing something here; can you take a picture of your ship in space? edit: I cannot find a way to put it on the engine, no matter what. How did you do it? re-edit: ooooooooh, I get it! The display of the stages to the left! However I did have an explosion... re-re-edit: okay, sometimes I lose the stage display on the left, sometimes not. The explosion happened every time (maybe I changed something? Doubtful). I need to find the root cause of this bug (me or SQUAD? Or both...), but right now, I have no clue. The only thing I have as a workaround is to "quit" to the tracking center and get back to my ship.
-
I chose the TNT since it's the most "childish" explosive I could think of; my goal was to make something ACME, not something serious. I did hesitate a while between this and a C4 pack, to appease the Mythbuster in me. Maybe when I get around to make a remote-detonated pack, I'll add a new model and use C4 for this one. Also, thanks guys for the nice comments on the model/texture! It was my first foray into Blender, so I'm glad it's okay. edit: I did a quick test at lunch: the "small delay to explode more?" It works great. I'll test some values (and maybe group some), but just putting a minimal delay and detonating the packs 10 per 10 at the same time should be enough. re-edit, okay, with 100ms between explosions and 12 packs per explosion, it works nicely without crashing. I did a "too much vessel" with 72 packs, and a "fireworks vessel" with 19 packs per booster and 6 boosters, they all exploded very nicely without too many errors/deadlocks in the logs. No crashes or lag. I'll do a release later; still want to put some sound.
-
I should have put a v0.1 somewhere. And a roadmap. I released it because after a few days of coding, it doesn't crash KSP when I detonate some packs. It can definitely be improved. This would be the next step for destroying debris, but I need to think about how it can be done in 0.16; maybe some sort of "put a pack if your Kerbal is near a vessel" thing. It's at the "end" of the roadmap since I need to learn about GUIs, and create some sort of "remote detonator" (which can track/explode some packs and leave the rest alone). I'm only guessing things about explosions now. I realized this morning that the max explosion potential must be 1 (fuel tanks are at 0.8), so putting 3, 10 or 100 like I did doesn't make them bigger. But if I explode many packs at the same time, the physics engine cries for mercy. I'll probably change this to "explode them at nearly the same time, with a small delay and an upper limit for the number of packs". That's definitely something I need to investigate and improve on; I want some fireworks too. As for many packs with various sizes and times... well, my goal is that for the size, you just add more packs, and for delayed explosions, you can clone the part and change the timer in the CFG; I'd like to keep it at "one pack per functionality" if possible (timed, remote, etc). They have crash resistance like any other part (maybe a bit high; it's still editable in the CFG), so they'll explode on the ground if they reach it . For damage, not sure it will work best with my code; as I said, it destroys the vessel with the part, and only collision damage seems to work in KSP (which is why rockets "explode" randomly; a part explodes, and then it's often 2 tanks crashing into each other due to inertia). You can try to put "timeBeforeExplosion=999" in the CFG; I need to check what happens in that case, but it should explode (and it's the "normal" way they explode, and what I should try to emulate). But I like the idea of "pack that doesn't explode by itself", since I already had to do something similar for the current one (as I said, exploding a few packs at the same time explodes KSP too). Not sure how I can limit the number of "timed" packs on a vessel, though. Otherwise, in my roadmap, there's also sound (a "beep...beep...beep" prior to detonation, spaced by one second) and making a better texture/model. I'll edit the first post with what I plan to do.
-
Do you feel your Kerbals bored, lacking the excitement of a big explosion near their command pod? Tired of cleaning space debris? Want to add that special "deathtrap" touch to your ships? Well, worry no more! Oi3 Demolition Inc. thought about you, and gives you the best way to achieve this with one simple part: the TNT Pack. v0.3.1: improved GUI for remote (now disappears and appears only if packs are "on") and added beepbeep sound (unzip the sound_beep.wav to the main KSP_WIN/Sounds directory). v0.3: added C4 pack (remote-triggered), improved on existing code, improved textures. v0.2: improved on explosions (new parameters in the .cfg: "maxExplosion" is the maximum number of TNT packs exploding per vessel, and "maxExplosionPerTick" the max number of packs at the same time). v0.1: first release. - (optional) Kerbals can place TNT packs on nearby ships - (optional) put a "5...4...3..." countdown - (optional) altitude-triggered explosions But what does it do? It's very simple: once stuck on any discarded stage, the TNT Pack will be prepared to blow up all the pieces. Once the TNT Pack decoupled, it will trigger a short countdown of 5 seconds (that you can change in the .cfg file), and voilà! No more parts floating in low-orbit! One pack per discarded vessel is enough for all cleaning needs. Can I put more than one pack on a future discarded part? How about twenty! Sure! When in doubt, more boom! The maximum per discarded vessel is 10 packs (above, they don't count). Sounds great! How do I install it? Get the file here: http://dl.dropbox.com/u/27482871/Oi3_v0.3.1.zip It contains the source code, the plug-in dll for explosives, and the TNT Pack part. Just put the files where they should be, and you're all set! The explosions didn't hurt me! I want weapons! Well, it IS space: since the TNT Pack destroys any debris (it's its main goal), it has no projectile value, since nothing is sent flying. That model kinda sucks. Yeah, it was my first 3D modeling experience. It does the job, but if someone wants to re-do the model (or add other kinds of explosive), he/she's free to propose them here. Anyway, tell me what you think, if it helps you clean your orbital space without finicking with the save file, or if you just wanted to emulate Wile E. Coyote. :
-
Stupid question, but it happened to me: did you have landing legs deployed below the engines? I learnt the hard way about action and opposite reaction.
-
Question about explosions ( I swear, it's not about weapons)
Neomatt replied to Neomatt's topic in KSP1 Mod Development
Okay, a bit more trial-and-error yesterday, and here's what I got: - I can retrieve/set the explosionPotential of a part by... calling part.explosionPotential. Dunno why I was expecting something else. I also saw some other variables like blastForce and the like; any idea what those are? (smells like moar testing) - destroying parts instead of exploding them is HARD. After many fails, I decided to set a part explosionPotential to 0 and explode it. However, that brings back the "old" issue if the explosion is too complex, with deadlocks and the like. - I tried to use Vessel.destroy(vessel), but it was a lost cause, didn't work. Shame, it would have been perfect. Also, this is more linked to my code, but if I think deadlocks are caused by the fact there is more than one TNT pack on a vessel (one is enough, but I know people will put 10 or 20 ) and they're trying to delete the same part at the same time. I may have to rethink how the destruction occurs (shared static list between TNT packs? One "master" pack that destroys the vessel, while the others just explode?) edit: well, it's done now. What I did: - Vessel.Die() kills the whole vessel without any fuss. It's perfect for my needs. - before that, each pack knows the "main" pack (first one in vessel.parts). The others are destroyed with the vessel, but their explosionPotential is added to the main one; this way, only one big explosion, much less (or no) deadlocks, and the vessel is destroyed. - the maxValue is set at 100, but since I didn't see a difference with 10, it's not very useful. Maybe I'll remove it. -
Oops. I'm a bit rusty in C#, sorry. Well then, disregard my post; you'll need to integrate the code from both modules in a new module "manually" (copy-paste the code). Since you'll need to do that manual merge at each update, it can get a bit tedious.
-
I don't think you can make it as a "double feature" with .CFGs alone; you'll need to "merge" the source files in a third type (not the code, but I'll explain below). Let's say you have a ModuleA class, importing from Part, and a ModuleB class, also importing from Part. Both classes have different methods, called onPartDestroy, onUpdate, etc. You'll probably have the same method redefined in both classes. So, to combine them, you'll need to make your "ModuleAB" class, importing from ModuleA and ModuleB. For each method, you'll need to do something like: void onPartDestroy() { (ModuleA)this.onPartDestroy(); (ModuleB)this.onPartDestroy(); } whilst being careful that base.onPartDestroy() is not called twice in each submethod. So yeah, not easy.
-
Hi, I've just started making a small plug-in/part to remove space debris (basically, a TNT bomb, Wile E. Coyote/ACME style, which triggers 5 seconds after being decoupled). My issue is not making the part (it's mostly done, except some CFG issues, but I can deal with that later), it's "how to explode the discarded stage with the bomb on it". If I just explode the pack, nothing explodes around it. If I decide to explode the pack and its parent, only those two are exploding (and projecting fuel tanks upward. Fun, but not what I expected). I finally tried what would have been the "best way": explode each and every part of the discarded stage (I used some sort of parent/children algorithm to get them all). It works fine for 2 tanks, an engine and a decoupler, buuuuuuut KSP crashes if I use it on my 36-tanks, 9-engines, 48-struts stage (since then, I removed the struts from the list; still crashes though) . It also creates deadlocks and the likes, and that's just a dirty, wrong way to make it happen. Now that I've thought a bit more about it, I'd think the best way to do this would be some sort of "now let's blow this thing and go home": a big, huge explosion, and other parts destroyed without exploding (this way, KSP just removes them and doesn't search to make a "fractal" explosion). So here are my questions: - is there a "good" way to explode a vessel completely? I think most of the issues are due to the "sum" of explosions I make by blowing each part. - is it preferable to do a "massive" explosion and part.onPartDestroy() than just part.explode()? - in the case it's preferable, what is a good "max" value for explosionPotential (not crashing, not lagging, still scares Jeb even if he's 2km away), and can it be set dynamically to a part via the API? (I made an "explosion.dll" already, so it's more of a "how can I set this") It would be best for it to go from something like 0.5 for a TNT pack alone to <maxValue> if you have more than 5 or 6 explosive parts. Anyway, if you have any ideas, please let me know.