Hello, beautiful peoples!
I want to start codding Factorio mods. I know that the language used is LUA but i don't understand how i am suposed to start because i'm French and 14 years old (true) and with my English level, my brain just don't allow me to understand this page: https://www.lua.org/download.html. So, i'll greatly appreciate if you just indicate what program i should use for compiling and the best IDE. I'll just find a LUA codding tutorial serie by myself and start codding using the Factorio's API.
So, thank in advance to help me.
PS: I'm on Windows 10 and i use an other PC with Windows 8
How to start modding Factorio?
- TheYellowBush
- Burner Inserter
- Posts: 6
- Joined: Fri May 19, 2017 6:05 am
- Contact:
How to start modding Factorio?
Aren't you exited? Aren't you happy?
You are going to be free.
Toby Fox, 2015
You are going to be free.
Toby Fox, 2015
-
- Fast Inserter
- Posts: 128
- Joined: Wed Dec 13, 2017 1:20 pm
- Contact:
Re: How to start modding Factorio?
Lua is compiled by Factorio, what is invisible to user/modder (see any existing mods that you downloaded).
to be more exact
to be more exact
https://en.wikipedia.org/wiki/Lua_(prog ... ementationLua programs are not interpreted directly from the textual Lua file, but are compiled into bytecode, which is then run on the Lua virtual machine. The compilation process is typically invisible to the user and is performed during run-time, but it can be done offline in order to increase loading performance or reduce the memory footprint of the host environment by leaving out the compiler.
Try googling for tutorials, see stickies like viewtopic.php?f=25&t=4858 .How to start modding Factorio?
- TheYellowBush
- Burner Inserter
- Posts: 6
- Joined: Fri May 19, 2017 6:05 am
- Contact:
Re: How to start modding Factorio?
Okay thank you verry much!
Aren't you exited? Aren't you happy?
You are going to be free.
Toby Fox, 2015
You are going to be free.
Toby Fox, 2015
Re: How to start modding Factorio?
All is table!
http://tylerneylon.com/a/learn-lua/
Also please install Notepad++, it can be very helpful.
http://tylerneylon.com/a/learn-lua/
Also please install Notepad++, it can be very helpful.
- Ranakastrasz
- Smart Inserter
- Posts: 2173
- Joined: Thu Jun 12, 2014 3:05 am
- Contact:
Re: How to start modding Factorio?
Notepad++, and start downloading other mods. Find ones with as few files as possible, smaller mods, etc, and poke them (I suggest my mod Agent Orange, it is very simple). Alter things and experiment to learn how stuff works.
Work with data first, don't touch scripting until you understand how the game objects are put together. Make a few custom recipes first, and alter items.
That's pretty much how I learned to do it. Better to use functional examples and alter them until you understand enough to work from scratch.
Good Luck!
Work with data first, don't touch scripting until you understand how the game objects are put together. Make a few custom recipes first, and alter items.
That's pretty much how I learned to do it. Better to use functional examples and alter them until you understand enough to work from scratch.
Good Luck!
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: How to start modding Factorio?
when I first started modding, it was literally copy an existing entity's definition, it's item and recipe, and make a new technology. Most of my mods have this structure.
Then people started using table.deepcopy to copy existing entities to a variable, tweak a few values (changing name= is important) and then adding them to the data.
Personally, whenever I write a new mod, I like to use util.merge. I used it in bobclass, and I've used it in boblogistics for some of the new inserters. Here's what I think is a good example.
To note, this is just the entity, you'll still need all the supporting things, like item, recipe, and a method to unlock it (technology) to go with it.
The advantages of table.deepcopy or util.merge is that when the base game entity changes, yours changes along with it, and things still work, vs if you've copy and paste the original entity and things change, you end up with an entity that doesn't work as you intended at best, a mod that doesn't load at worst.
Then people started using table.deepcopy to copy existing entities to a variable, tweak a few values (changing name= is important) and then adding them to the data.
Personally, whenever I write a new mod, I like to use util.merge. I used it in bobclass, and I've used it in boblogistics for some of the new inserters. Here's what I think is a good example.
Code: Select all
data:extend(
{
util.merge{
data.raw.inserter["stack-inserter"],
{
name = "red-stack-inserter",
icon = "__boblogistics__/graphics/icons/inserter/red-stack-inserter.png",
minable = {hardness = 0.2, mining_time = 0.5, result = "red-stack-inserter"},
extension_speed = 0.07,
rotation_speed = 0.03,
energy_per_movement = 17500,
energy_per_rotation = 17500,
energy_source =
{
type = "electric",
usage_priority = "secondary-input",
drain = "0.8kW"
},
}
}
}
)
The advantages of table.deepcopy or util.merge is that when the base game entity changes, yours changes along with it, and things still work, vs if you've copy and paste the original entity and things change, you end up with an entity that doesn't work as you intended at best, a mod that doesn't load at worst.
Re: How to start modding Factorio?
1) choisi un editeur qui te conviens, pour ma part j'utilise eclipse
2) idéalement il vaut mieux utiliser un outil de versionning genre git, c'est pour pouvoir revenir en arriere ou ne pas tout perdre
3) avoir de la patience et de la persévérence
en dehors de cela comme dit avant y a pas de compilation à faire faut juste bien faire attention à mettre "Local" devant toutes tes variables évoluants pendant l'exécution du script sinon ca marchera pas en MP.
je ne peux que conseiller de faire des adaptateurs (module qui appel les attributs ou fonction des classes factorio, ex: https://github.com/Helfima/helmod/blob/ ... Player.lua) ca demande plus de boulot au début mais ou moins quand un truc change c'est bcp plus rapide et stable pour ton code.
pour info mon mod Helmod ne modifie pas le jeu c'est un assistant le plus chaud à été de rendre l'interface utilisable en toute circonstance.
2) idéalement il vaut mieux utiliser un outil de versionning genre git, c'est pour pouvoir revenir en arriere ou ne pas tout perdre
3) avoir de la patience et de la persévérence
en dehors de cela comme dit avant y a pas de compilation à faire faut juste bien faire attention à mettre "Local" devant toutes tes variables évoluants pendant l'exécution du script sinon ca marchera pas en MP.
je ne peux que conseiller de faire des adaptateurs (module qui appel les attributs ou fonction des classes factorio, ex: https://github.com/Helfima/helmod/blob/ ... Player.lua) ca demande plus de boulot au début mais ou moins quand un truc change c'est bcp plus rapide et stable pour ton code.
pour info mon mod Helmod ne modifie pas le jeu c'est un assistant le plus chaud à été de rendre l'interface utilisable en toute circonstance.