Wiki: Current and future

Anything related to the content on our wiki (https://wiki.factorio.com/)

Moderator: Bilka

Smee
Inserter
Inserter
Posts: 21
Joined: Tue Mar 11, 2014 7:46 am
Contact:

Re: Wiki: Current and future

Post by Smee »

Heading home for the day now. I've made a start at some changes/edits. See what you think and if they're in a style that fits.

Don't give up on the concept of the logistics network - I have some ideas there. :)
"The path of my life is strewn with cowpats from the Devil's own Satanic Herd!"

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Wiki: Current and future

Post by ssilk »

Well done, keep on.

I write my ideas in most cases down, sometimes in the discussion namespace of a page and let them mature. Currently I begun to put everything into SimpleMind, perhaps I find a way.

And to the above post: I tend to see all dark. :) Being more neutral I see this: there will be a lots of changes within this year. A practical standpoint is just adding the new stuff/changes to the wiki as good as possible, or just add it so that it is there and think to new documentation concepts later, when the game is stabilized.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: Wiki: Current and future

Post by sillyfly »

I came by this thread while looking at documentation stuff, and I got along to writing a simple converter for XML.
It is not yet completely finished, and I'm sure it's rather ugly and inefficient, as it's the first time I've used Lua, and the data structure can be... confusing.
I'm using cube's Loader to load the data, and genx (http://genx.luaforge.net/index.html) to generate the XML, which I may switch. it is the first Lua XML library I found, but it seems like it has many downsides. One such downside is that the XML is not formatted very pretty, but this is easily fixable with xmllint (http://xmlsoft.org/xmllint.html).

Here is an example of the XML output (for Rocket Defense, just because :P )

Code: Select all

<?xml version="1.0"?>
<item>
  <name>rocket-defense</name>
  <display>Rocket defense</display>
  <type>entity</type>
  <icon>__base__/graphics/icons/rocket-defense.png</icon>
  <recipe ingredientCount="5">
    <category/>
    <time>0.5</time>
    <ingredient>
      <item>
        <name>rocket</name>
        <display>Rocket</display>
        <type>entity</type>
        <icon>__base__/graphics/icons/rocket.png</icon>
      </item>
      <count>100</count>
    </ingredient>
    <ingredient>
      <item>
        <name>advanced-circuit</name>
        <display>Advanced Circuit</display>
        <type>item</type>
        <icon>__base__/graphics/icons/advanced-circuit.png</icon>
      </item>
      <count>128</count>
    </ingredient>
    <ingredient>
      <item>
        <name>processing-unit</name>
        <display>Processing Unit</display>
        <type>item</type>
        <icon>__base__/graphics/icons/processing-unit.png</icon>
      </item>
      <count>128</count>
    </ingredient>
    <ingredient>
      <item>
        <name>speed-module-3</name>
        <display>Speed module 3</display>
        <type>item</type>
        <icon>__base__/graphics/icons/speed-module-3.png</icon>
      </item>
      <count>50</count>
    </ingredient>
    <ingredient>
      <item>
        <name>productivity-module-3</name>
        <display>Productivity module 3</display>
        <type>item</type>
        <icon>__base__/graphics/icons/productivity-module-3.png</icon>
      </item>
      <count>50</count>
    </ingredient>
  </recipe>
</item>
and the actual code, which I'm still hoping to make better/add features:

Code: Select all

require 'genx'
local Loader = require('loader')

local data_path = "~/games/factorio/data"

local types = {"entity", "equipment","item"}

function getDisplayNameType(name, lang)
	local i_type = "unknown"
	local display_name = nil
	for i=1, #types do
		if not display_name then
			display_name = Loader.translate(types[i] .. "-name." .. name,lang)
			if display_name ~= nil then
				i_type = types[i]
			end
		end
	end
	return display_name, i_type
end

function getIcon(name)
	for i=1,#Loader.item_types do
		local t=Loader.item_types[i]
		if Loader.data[t][name] then
			return Loader.data[t][name]["icon"] or "?"
		end
	end
	return "?"
end

function addItem(doc, item_name, include_recipe)
	
	local i_type = "unknown"
	local display_name = nil
	display_name, i_type = getDisplayNameType(item_name, "en")
	
	if not display_name  then
		display_name = item_name
	end
	
	

	doc:startElement('item') -- start item

	doc:startElement('name')
	doc:text(item_name)
	doc:endElement()
	
	doc:startElement('display')
	doc:text(display_name)
	doc:endElement()
	
	doc:startElement('type')
	doc:text(i_type)
	doc:endElement()
	
	doc:startElement('icon')
	doc:text(getIcon(item_name))
	doc:endElement()
	
	if include_recipe then
		local recipe = Loader.data.recipe[item_name]
		if recipe then
			addRecipe(doc, recipe)
		end
	end
	
	doc:endElement() -- end item
end

function addRecipe(doc, recipe)
	doc:startElement('recipe')
	doc:attribute('ingredientCount', #(recipe.ingredients) or -1)
	
	cat = recipe.category or ""
	time = recipe["energy_required"] or 0.5
	if cat=="smelting" or not time then
		time = "?"
	end
	
	doc:startElement('category')
	doc:text(cat)
	doc:endElement()
	
	doc:startElement('time')
	doc:text(time)
	doc:endElement()
		
	for i =1, #(recipe.ingredients) do
		local ing = recipe.ingredients[i]
		i_name = ing.name or ing[1]
		i_count = ing.amount or ing[2]
		
		doc:startElement('ingredient')
		
		addItem(doc, i_name, false) -- add the ingredient data
		
		doc:startElement('count') -- add count for ingredient
		doc:text(i_count)
		doc:endElement()
		
		doc:endElement() -- ingredient
		
	end
	doc:endElement() -- recipe
end

Loader.load_data({data_path .. "/core", data_path .. "/base"})

for k,item in pairs(Loader.data.item) do
	local d = genx.new(io.open("xmls/" .. item.name .. ".xml", "w"))
	addItem(d, item.name, true)
end

If you want to try it yourself change data_path to your local factorio installation path and make a folder named "xmls" where your script is (I haven't made the effort to find out how to create a folder in Lua, although I'm sure it's not complicated). To make the xmls prettier (nice for humans, shouldn't matter for computer processing ) you can use this (on linux):

Code: Select all

find . -name "*.xml" -type f -exec xmllint --output '{}' --format '{}' \;

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Wiki: Current and future

Post by ssilk »

Nice. I'll take a look at it, I searched for example for such an XML-converter lib a lot of time and at least I came up with a very simple XML-Tree.

The source can be found here:
https://github.com/alexaulbach/Factorio ... iGenerator

This converter works very good yet, it was one of my first Lua-programs.

I thought then long, if I should use XSLT to convert the XML to WIKI-Pages. But in the end I thought, no, it must be maintainable! :) And no, I don't want to discuss, if XSLT is well maintainable or not.

So I think PHP is a wonderful language to make the proposed HTML-pages out of that. Sadly I didn't have much time for that - even if I'm just only some hours away from creating a bunch of WIKI-pages with this.
I have holidays and the weather is too good. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

sonic
Burner Inserter
Burner Inserter
Posts: 17
Joined: Thu Jul 03, 2014 5:52 pm
Contact:

Re: Wiki: Current and future

Post by sonic »

Would it make sense to include a 'Required Technology' section in each item's wiki entry?

Eg, Assembler 1

Required Technology

Automation 1 (icon and link to page)

edit: Also a 'crafted by' section like the game has (assembler/chem plant/refinery).

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Wiki: Current and future

Post by ssilk »

I'm not 100% sure! but I think I saw that for some pages ...

https://forums.factorio.com/wiki/inde ... ience_pack

A template is more useful for that...

The current problem is also, that we have name collisions or example the rocket defence:
https://forums.factorio.com/wiki/inde ... et_defense
https://forums.factorio.com/wiki/inde ... (research)

This is a problem, cause it makes editing much more complex: which is the name of that page?
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Grey
Long Handed Inserter
Long Handed Inserter
Posts: 68
Joined: Mon Jun 17, 2013 5:11 pm
Contact:

Re: Wiki: Current and future

Post by Grey »

I am sure lots of people will insult me for necroposting, but after steam release the topic of this thread is more relevant than before. So in my eyes as some of the points initially mentioned got already done for example the separated subdomain, other have been pushed again and again. And some mechanics like the logic comparators are very underrepresented in the wiki according to their use and possibilities especially in late game.

From my side the wiki got to big to have an overview of everything. Even if I find myself some 15 minutes of time I almost waste them on checking what is to be done. As we all have learned from the factorio team itself, organization is a great help. So not sure if there is already something like a "TODO" thread. Everybody can add a post what he found missing, people from wiki can then fix it and maybe by "reporting" it the forum mods will delete the post so the list itself can be kept short instead of having it growing.

Next point is double entries:
we have some pages which cover somehow at least 80% of the same topic. So we should check for those doubles and try to merge them, using the 3 tier layout that has already emerged over the past and categorizing knowledge in beginner, advanced and expert.
For example:
https://wiki.factorio.com/index.php?tit ... ort_system
https://wiki.factorio.com/index.php?tit ... port_belts

maybe we should separate some tasks according to user skill. For example even beginner users can add simple page stubs for items, while it requires some more skills to provide expert knowledge on belt physics and railroad gridlock protection.
this could also be on the TODO list.

long time ago I promised kovarex to keep an eye on the wiki, ... I failed miserably. :( But as they have shown use what a great fun game they could make, let us show them that we appreaciate their work even after our payment in hard $$$.

majorwitty
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Mar 13, 2016 8:37 am
Contact:

Re: Wiki: Current and future

Post by majorwitty »

I'd like to thank Factorio game devs for having a https://wiki.factorio.com/ that is hosted by themselves and not that ad loaded garbage format other games seem to use.

I plan to participate in the wiki documentation. I like the basics of Factorio. I like using wikis (authoring and reading) and I like pictures.

Post Reply

Return to “Wiki Talk”