Jump to content

SalehRam

Members
  • Posts

    175
  • Joined

  • Last visited

Reputation

35 Excellent

Profile Information

  • About me
    I am supposed to be an engineer

Recent Profile Visitors

1,612 profile views
  1. Referencing this post in GD I have managed to make this little class in C#, which will get an SFS file and turn it into nodes and subnodes, while maintaining an index for each node to allow modification and changes to its values... I thought I share the work with the community and get your feedback on this, I'm by no means a developer, but I take this as a hobby and interest, so I might (almost certainly) off the track for how devs do stuff, but at least it works... This is my first serious attempt with C# as well... Github link: https://github.com/salehram/SFSReaderClass/
  2. https://github.com/salehram/SFSReaderClass That's my mess... Might look awkward the way I did this, but I was just going through with my thoughts... The idea is you will get 2 references, one is visualized in the node tree, the other one is a sort of dictionary for the whole file. When an item from the tree is selected, there is an index for it, that index then will be matched from the other reference which also contain the line number of each line of the SFS file, that way, direct search and modifications are possible. a complete file rewrite can be done... There are few things that I need to complete yet, but this is about 90% of the work, and that is my whole POC project about this... I did it because it was fun - and to break the wall with C# Edit: I took the approach of looping through the file and looking for nodes start and ends rather than regex because I built all of this on the assumption that I know nothing about the format of the file and what standard if follows. I know that node titles are capitalized, and I know the main node titles (GAME, PARAMETERS, CAREER, VESSEL, etc...), but that was not enough for me... it is not like having a full documented standard like JSON, YAML or others... so I approached this as a completely unknown format and dealt with it based on that PS: Can I ask for this to be moved to the development forum now that it has a content relevant to there?
  3. About 6.5mb, it has about 313,000 lines as well I will include it in the github repository once I upload it
  4. Got something going... Will get it on Github once I get home, it is C# though (I thought why not get out of the box anyways and do something new all together). Basically, I take the file, read it line by line, index the nodes, and their sub-nodes. Using 5-d array, a treenode object to build the structure. I thought about using dataset, xml file, dictionaries, but the thing is, I could think about it easily done with a 5-d array like: [original line number in sfs file, tab spaces (/t), property name, property value, the index of the property in treenode] The brackets "{,}" are going to be ignored, and the node headers are not going to be included in the array as well. I'm now at the point of building the treenode structure, and once that is done, everything is done. Once that is completed, searching, through the array will be possible and I believe I can do anything with the content that I will get at the end. As for the memory usage, so far it goes up to 30mb, implementing the array will bump it another 60 or 90 mb, so I am talking about a total of 150mb
  5. First, I would go through the steps to do this from scratch is because 1. I enjoy it, 2. I tend to go to the "do it yourself" approach when I really and badly need a thing and not find it, at one point, I really needed to work with SFS files quickly and easily, and while I appreciate the tools that are available out there, my own criteria was still not satisfied... So, the idea I will work on is: Read the SFS file line by line, map every line in the file, then manipulate the whole file and convert it into something compatible with standard markdown formats (be it JSON, XML or whatever, though JSON for me seems easier). and link every line of the new file to the matching line of the original file When I finish working with the file, I simply merge the values of file with the original one based on the map and links I created earlier in the process... Because of the nature of this, I will need to use a tool (programming language) that I feel very comfortable with, and that is VB.NET as I know others, but I have been with VB/VB.NET since 1996. (as a hobby) I'll put the project on github later for contributions
  6. Just for the sake of sharing ideas and knowledge, these are my observations and idea about reading the sfs file as a JSON: Part of sfs file: GAME { version = 1.1.2 Title = DrMath (CAREER) Description = No description available. linkURL = linkCaption = Mode = CAREER Status = 1 scene = 5 editor = None flag = Squad/Flags/hexagon launchID = 47 modded = True envInfo = - Environment Info - Win32NT 7FFFFFFFFFFFFFFF Args: KSP_x64.exe - PARAMETERS { preset = Custom FLIGHT { CanQuickSave = True CanQuickLoad = True CanAutoSave = True CanUseMap = True CanSwitchVesselsNear = True CanSwitchVesselsFar = True CanTimeWarpHigh = True CanTimeWarpLow = True CanEVA = True CanIVA = True CanBoard = True CanRestart = True CanLeaveToEditor = True CanLeaveToTrackingStation = True CanLeaveToSpaceCenter = True CanLeaveToMainMenu = False } EDITOR { CanSave = True CanLoad = True CanStartNew = True CanLaunch = True CanLeaveToSpaceCenter = True CanLeaveToMainMenu = False startUpMode = 0 craftFileToLoad = } } } And an example of a JSON structure: {"widget": { "debug": "on", "window": { "title": "Sample Konfabulator Widget", "name": "main_window", "width": 500, "height": 500 }, "image": { "src": "Images/Sun.png", "name": "sun1", "hOffset": 250, "vOffset": 250, "alignment": "center" }, "text": { "data": "Click Here", "size": 36, "style": "bold", "name": "text1", "hOffset": 250, "vOffset": 100, "alignment": "center", "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" } }} So, I can load the sfs into memory (it is going to eat the hell out of the memory), then implement a function that will modify the text to match the JSON structure exactly, such as replacing the equal signs, adding quotation marks and value commas, etc... and then the remaining is easy for a JSON library... This is one approach, which I both like and dislike, as it will add some complexity and make some double work... Other approach, which I kinda prefer, is to write a function that will read the whole sfs line by line and determine the key and the value, then outputs it in an XML format... However, that will require more work but the result will be much more rewarding from the previous approach for me...
  7. Looking at JSON structure (which I am familiar with, but somehow I missed the very similarity with sfs), I think with some few manipulations to text after loading it into my application I can utilize standard JSON libraries to read the text
  8. Hello, I have asked this in the addons development forum but got no answer... So I woul like to know the format of the sfs save files, are they following a standard or is it just a format made up by squad? I need to know this as I am planning to do a small app using .NET that can work with sfs to do specific tasks that I could not find somewhere else... Thanks a lot!
  9. Hello I am looking to write a small app that I need for a specific purpose. To do that, I need to work the the sfs files. What is the structure of these files? I noticed they follow indent and node format, but it would be nice if they do this based on a standard with libraries or tools available to make working with them a bit easier... If not, then I will have to write the code myself to read the sfs nodes and headers... Thanks in advance Saleh
  10. I would say go hunt for asteroids... They are more PITA to rendezvous with than normal ships specially if they have a trajectory inside Kerbin SOI... Or maybe mess with aerobraking and atmospheric reentry, that will become very useful later in the advanced stages of your game... Maybe also build a modular space station now that you can dock stuff together, you can build an all purpose interplanetary ship that can go anywhere... For getting control back of your ship, maybe try the keys "[" or "]" switch to something other than your ship, then switch back to it, that should fix things if you cannot control it somehow. IF you are using REMOTETECH, then that is a different story, where you need an active antenna and an active connection to KSC or a command station to be able to control probes and unmanned ships...
  11. I have been playing KSP since 0.23, and I only gone out to Eve and Duna, and last planet was Moho after I was about to lose my brain... Moho was the most painful to get there, I only did it briefly on sandbox not career, so now I am preparing my career to do interplanetary trips again.
  12. Nah, it is not related to the planet, the body you are orbiting can only influence the orbital speed and altitude, but cannot affect the good separation distance which you can work in it to rendezvous... At the end, when you are chasing/meeting an object in orbit, you don't really care about anything other than your relative velocity, inclination and distance from that object, other things (assuming you don't over correct and fall into atmosphere/surface) are just data (aka: have no meaning for you yet at this stage) for this situation.
  13. 1000km is still very far away... usually rendezvous is considered possible when you get really really close like less than 50km or something... You need to play with maneuver nodes to get much more close encounter... Get yourself either in a higher orbit or lower orbit relative to your target and then place a meneuver node and play with it... dont worry if you need to complete multiple orbits before getting the close encounter you need... try to get something like 10km or less separation distance, then the tips we said above will help you reach your target... Also make sure your ascend/descend nodes are no more than 1 or -1 degrees this is important
  14. Doing the trick of pressing Z key then X quickly DOES change your current orbit numbers, so that will affect the current node. You can make an estimate of the burn time and assume it is a value between the multiple values you have seen, then execute the node based on that, then after you execute the node, make any required corrections not to far from the original location of the node... This is how I do it at least... If you are having RCS on, then turn it off before turning towards the maneuver node. RCS generates thrust when turning or rolling, thus affecting the upcoming node. Also SAS can have some effects, but not major like RCS...
  15. Did not read the other replies, but I am sure they are well explained and detailed, but my short and quick tips are: When you get really close to your target in orbit (such as 10km or around that range), your navball references will change to be related to your target velocity. If you are very close to your target, and your navball is still using your own orbit velocity as a reference, you can click the little box on top of the navball that shows what reference is the navball using (such as orbit, surface, or target). Once your navball is referring to your target, first make sure you burn retrograde (related to the target) until you get your speed to be 0m/s related to the target speed. Then point your craft to the target itself (the purple indicator on the navball), burn a little bit, this should set your prograde (relative to target) indicator on top of the target indicator. Make sure you don't go fast, for starters do it slow, like 10m/s or something, then keep watching your prograde indicator, it WILL drift, watch it as it drifts away form the target indicator. When you feel the drift is now large, you need to kill your relative velocity to the target, this will take you back to step 2, so go back to step 2 and repeat the circle until you get to meet your target. Hope these helps, this is how I did it once I wanted to learn rendezvous and docking. Once you master this, you can make your rendezvous faster with more practice and time... There is the mod Docking Port Alignment Indicator, which is an awesome docking mod, but I really don't recommend using mods for a thing until you know how it works without the mod, then use the mod to save time or have more controls or numbers at your screen. I only use this mod for large crafts dockings, but form medium/small ships, I just use the stock docking methods.
×
×
  • Create New...