Jump to content

Is there a simple demo template out there?


Recommended Posts

Hey all, I'm trying to get into this modding business to realize an idea that struck me the other night, but to even get started, I have to get my head around C# and how it's used in the game.

My idea requires creation of custom windows during flight, like Kerbal Engineer, Protractor or MechJeb, but none of those offer source code that I can reference. I've been looking through the source for Actions On The Fly, but it's quite cryptic to me at the moment.

Sadly, the only basic examples I can find for plugin creation focus more on actual part modeling and cfg editing, and a single elementary example of how to inject a line into the log. These examples all assume that the reader is already completely fluent in C#, and seem to be centered around giving a basis for understanding the simplest interaction with the game's methods, but I need a little more than that to go on.

For now, the functions I'm trying to create use a simple window with a few buttons to offer up the contents of a text file, and to display the current assigned action groups. There's a lot more expansion I have planned, but for now I want to keep the goals simple. I learn best when I have a goal in mind, and I don't want to discourage myself by biting off more than I can chew.

What I need is some kind of basic template that uses less cryptic names so I can gain some understanding of what does what, at which point I will begin to understand how the syntax works. I already have some JS and VB.net experience, so some of what I'm seeing makes sense already; I'm just too inexperienced to understand this well enough to see how it works in context with the game engine. If there isn't some kind of teaching template out there, does anybody at least know of a simple plugin that:

  • Does a simple display of information in a custom window in-game
  • Offers the source in the download, and
  • Has decent commenting to help the reader understand what's going on

I appreciate very much any help to get me fired off in the right direction (so to speak)! :D

Link to comment
Share on other sites

I would recommend taking a look at Cybutek's tutorial series if you have no experience with KSP plugin writing. He uses Visual Studio but you could also use the version of MonoDevelop that comes bundled with Unity3D (in fact I prefer MonoDevelop, not only because VS is Windows-only and I'm on a Mac, but also for the Unity debugger and the coding prompts).

If you've used JavaScript then C# isn't too different, but there are some significant differences between the two.

Also look at this: http://docs.unity3d.com/Documentation/ScriptReference/index.html

It's got all (or most) of the API for Unity's classes, functions, etc.

http://wiki.kerbalspaceprogram.com/wiki/Community_API_Documentation

The KSP API documentation is far from complete, but it's got good info that you can use to optimize code a little (we plugin writers should probably work on it some, eh?)

Cybutek's Plugin Tutorial Playlist:

Link to comment
Share on other sites

I would recommend taking a look at Cybutek's tutorial series if you have no experience with KSP plugin writing. He uses Visual Studio but you could also use the version of MonoDevelop that comes bundled with Unity3D (in fact I prefer MonoDevelop, not only because VS is Windows-only and I'm on a Mac, but also for the Unity debugger and the coding prompts).

If you've used JavaScript then C# isn't too different, but there are some significant differences between the two.

Also look at this: http://docs.unity3d.com/Documentation/ScriptReference/index.html

It's got all (or most) of the API for Unity's classes, functions, etc.

http://wiki.kerbalspaceprogram.com/wiki/Community_API_Documentation

The KSP API documentation is far from complete, but it's got good info that you can use to optimize code a little (we plugin writers should probably work on it some, eh?)

Cybutek's Plugin Tutorial Playlist:

*THAT'S* what I needed with the video tutorials! I have to see some examples in action in order to start coming to grips with what's happening. Looks like I've got my educational/entertainment lineup set for tonight.

Thanks a bunch! :)

Link to comment
Share on other sites

Well... shoot.

Looks like B9 Aerospace pack includes a unit called "Info Drive" that does almost everything I wanted to put together. It shows the assigned action groups (with custom descriptions rather than just the default part names), and has a log section as well. ;.;

Well, at least I can take a look at how it's done, and maybe release a standalone part that expands on the idea (no, I know better than to just rip the code and proceed from there!)

EDIT:

Dagnabbit! There's no source code, and no link to it that I can find for the pack. Gonna have to try hunting it down through the various people associated with it, looks like.

Also, it seems the Info Drive's custom info is only good for the individual deployed ship, and is only persistent with that ship, though I can't for the life of me figure out where it's storing the data.

EDIT2:

Okay, I lied. The info is persistent with the ship, as long as you enter the information in the SPH/VAB, when you open the Action Groups menu and click the Info Drive part. The text you enter is saved with the .craft file when you re-save it again. Anyway, found the source I needed, so now it's time to play! :D

Edited by Deadweasel
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...