Jump to content

Can I make new fuel types? How do I do it?


Xannari Ferrows

Recommended Posts

I work with programming a lot. Heck, I programmed Mariyate to work with me. Of course, she created her own extensions to become ever changing, but that's the thing. There's always been one file type I've never figured out properly. .Dll

The question is: Is it possible to introduce new fuel types that work the same way as stock fuels do, but require no additional plugins?

I've asked around on Crescendo a bit, but no one seems to know the right answer. Some say it's possible, some say it isn't. Anyway, I've seen threads about going into the resources folder and modifying some things, but when I start up the game, the resources aren't present in anything, even after modifying some part files to include them, such as Liquid Hydrogen in place of Liquid Fuel, so that isn't the case. Anyone know how it's done?

I'm gonna say right now, I'm not a pro. I'm not as keen with programming as a lot of people. I'm not even sure if new fuel types require Dlls, and that speaks for itself.

That being said, do you perhaps know how a fuel is created? If so, how?

NOTICE: As you might have guessed, I want to create a fuel mod, and have even started making models for various parts to fit the central purpose. If you can tell me how to make fuels and what is required for it, you will get first access to the mod. Of course, it will be fairly small as it will be my first, but later I could create more.

EDIT: In case you didn't exactly get all the information for an answer, just ask me and I can elaborate.

Link to comment
Share on other sites

Yes, you can. It doesn't require a plugin, and it's not difficult - even Squad's fuels are just a few lines in a config file.

Look at: GameData\Squad\Resources\ResourcesGeneric.cfg

There you will find the definitions for liquid fuel and oxidizer (and a whole bunch of other stuff):

RESOURCE_DEFINITION
{
name = LiquidFuel
density = 0.005
unitCost = 0.8
flowMode = STACK_PRIORITY_SEARCH
transfer = PUMP
isTweakable = true
}
RESOURCE_DEFINITION
{
name = Oxidizer
density = 0.005
unitCost = 0.18
flowMode = STACK_PRIORITY_SEARCH
transfer = PUMP
isTweakable = true
}

Following that example, you can easily create your own RESOURCE_DEFINITION. Just copy the LiquidFuel one, adjust name, density (weight in metric tonnes of 1 unit ingame) and unitCost to your liking. Write this into a textfile, name it myresources.cfg, and place it into for example /GameData/MyStuff.

Now you need a tank for your new fuel. Look at GameData\Squad\Parts\FuelTank\fuelTankT800\fuelTankT800.cfg

At the bottom of the config file, there's these two nodes:

RESOURCE
{
name = LiquidFuel
amount = 360
maxAmount = 360
}
RESOURCE
{
name = Oxidizer
amount = 440
maxAmount = 440
}

Those tell the tank what it stores, how much it can store, and how much there is in it by default. You can now copy the entire fuelTankT800 folder from Squad to /GameData/MyStuff. Rename it so you know what it is. Rename the config too. Go into the config, edit the stuff under "editor parameters" to your liking, change name and author under "general parameters", and edit the RESOURCE nodes to contain your new fuel instead of the LF/O mix. You'll probably want one single node with 800 units. Unless you gave your resource a different density, in which case your tank is going to be either lighter or heavier than stock LF/O mix unless you adjust the number of units present.

You should now be able to start up KSP and see in the VAB a copy of the FL-T800 fuel tank, except that it carries the name that you gave it, and contains your new fuel.

Finally you need an engine that consumes the new fuel. Look at an engine config, such as for example GameData\Squad\Parts\Engine\liquidEngineLV-T30\liquidEngineLV-T30.cfg

There you can see how the engine is told to use resources as propellant:

MODULE
{
name = ModuleEngines

(other stuff)

PROPELLANT
{
name = LiquidFuel
ratio = 0.9
DrawGauge = True
}
PROPELLANT
{
name = Oxidizer
ratio = 1.1
}

(other stuff)

}

You do the same with this engine as you did with the fuel tank: copy the entire engine folder to /GameData/Mystuff, rename the folder and the config name for convenience, go into the config and change part name, author and editor parameters, and finally make it so that instead of LF/O mix, it uses your new resource.

If you start the game now, you should find a copy of the LV-T30 engine that carries your name and uses your fuel. Stick it under your fuel tank, put a capsule on top, and launch! :)

Now, if you want to get deeper into this, you either want to create your own tanks and engines instead of copying Squad's; or, you want to change certain existing parts to use your new fuel resource instead of what they used before. For the former, you'll have to learn 3D modeling and texturing; for the latter, look at a mod called ModuleManager which allows you to write simple patches (in a syntax very similar to how the config files work) that will overwrite the base configs at runtime. You can make it change all of Squad's engines to your new fuel, for example, instead of creating copies of the engines.

Link to comment
Share on other sites

Yes, you can. It doesn't require a plugin, and it's not difficult - even Squad's fuels are just a few lines in a config file.

Look at: GameData\Squad\Resources\ResourcesGeneric.cfg

There you will find the definitions for liquid fuel and oxidizer (and a whole bunch of other stuff):

RESOURCE_DEFINITION
{
name = LiquidFuel
density = 0.005
unitCost = 0.8
flowMode = STACK_PRIORITY_SEARCH
transfer = PUMP
isTweakable = true
}
RESOURCE_DEFINITION
{
name = Oxidizer
density = 0.005
unitCost = 0.18
flowMode = STACK_PRIORITY_SEARCH
transfer = PUMP
isTweakable = true
}

Following that example, you can easily create your own RESOURCE_DEFINITION. Just copy the LiquidFuel one, adjust name, density (weight in metric tonnes of 1 unit ingame) and unitCost to your liking. Write this into a textfile, name it myresources.cfg, and place it into for example /GameData/MyStuff.

Now you need a tank for your new fuel. Look at GameData\Squad\Parts\FuelTank\fuelTankT800\fuelTankT800.cfg

At the bottom of the config file, there's these two nodes:

RESOURCE
{
name = LiquidFuel
amount = 360
maxAmount = 360
}
RESOURCE
{
name = Oxidizer
amount = 440
maxAmount = 440
}

Those tell the tank what it stores, how much it can store, and how much there is in it by default. You can now copy the entire fuelTankT800 folder from Squad to /GameData/MyStuff. Rename it so you know what it is. Rename the config too. Go into the config, edit the stuff under "editor parameters" to your liking, change name and author under "general parameters", and edit the RESOURCE nodes to contain your new fuel instead of the LF/O mix. You'll probably want one single node with 800 units. Unless you gave your resource a different density, in which case your tank is going to be either lighter or heavier than stock LF/O mix unless you adjust the number of units present.

You should now be able to start up KSP and see in the VAB a copy of the FL-T800 fuel tank, except that it carries the name that you gave it, and contains your new fuel.

Finally you need an engine that consumes the new fuel. Look at an engine config, such as for example GameData\Squad\Parts\Engine\liquidEngineLV-T30\liquidEngineLV-T30.cfg

There you can see how the engine is told to use resources as propellant:

MODULE
{
name = ModuleEngines

(other stuff)

PROPELLANT
{
name = LiquidFuel
ratio = 0.9
DrawGauge = True
}
PROPELLANT
{
name = Oxidizer
ratio = 1.1
}

(other stuff)

}

You do the same with this engine as you did with the fuel tank: copy the entire engine folder to /GameData/Mystuff, rename the folder and the config name for convenience, go into the config and change part name, author and editor parameters, and finally make it so that instead of LF/O mix, it uses your new resource.

If you start the game now, you should find a copy of the LV-T30 engine that carries your name and uses your fuel. Stick it under your fuel tank, put a capsule on top, and launch! :)

Now, if you want to get deeper into this, you either want to create your own tanks and engines instead of copying Squad's; or, you want to change certain existing parts to use your new fuel resource instead of what they used before. For the former, you'll have to learn 3D modeling and texturing; for the latter, look at a mod called ModuleManager which allows you to write simple patches (in a syntax very similar to how the config files work) that will overwrite the base configs at runtime. You can make it change all of Squad's engines to your new fuel, for example, instead of creating copies of the engines.

Well that was a bit easier than I expected. Thank's for telling me this! Liquid Hydrogen and Liquid Oxygen have been added to the game!

I am currently in testing for part optimization and pixel measurements for the modelling, so it'll be quite a bit before I make a release, but when I do, you'll be the first to be notified!

BTW, sorry for the very delayed response. I'd gone to sleep last night and only now decided to check my mail.

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...