Page 2 of 2
Re: Prototype error(s) improvements
Posted: Tue Oct 11, 2016 10:20 am
by mexmer
Mooncat wrote:mexmer wrote:for item/entity prototype we don't need exactly doc, validation schema should be enough.
i suspect they are using something like this
http://json-schema.org/ otherwise writing validator for any and every item type will be tedious task.
Validator can only tell you whether you are doing it right or not, but it can't tell you what you can actually do.
There was some time people don't know the "localised_name" attribute exists, because it is not found in vanilla files, and I bet many people still don't know there is also "localised_description". I knew it by accident.
To me, I didn't know about sprite prototype until I saw aubergine's github issue here:
https://github.com/aubergine10/Style/issues/33
There are still much we need to figure out. So I would say, we do need a detailed document for what we can put in the prototype files.
i don't ask for validator, because i believe they use it, i ask for validation schema.
if you know schema, you know which nodes/elementes are required, and which are optional, also for which type.
if you ever worked with it (or similarily with DTD for XML data), you will know what i mean.
other option will be to have "commented" prototype for every entity/item type, but i don't believe that is possible to get, even if we ask 1000 times

Re: Prototype error(s) improvements
Posted: Tue Oct 11, 2016 10:34 am
by Mooncat
mexmer wrote:i don't ask for validator, because i believe they use it, i ask for validation schema.
if you know schema, you know which nodes/elementes are required, and which are optional, also for which type.
if you ever worked with it (or similarily with DTD for XML data), you will know what i mean.
other option will be to have "commented" prototype for every entity/item type, but i don't believe that is possible to get, even if we ask 1000 times

Oh! Sorry, I am not familiar with schema. I have heard this term but don't know what is it.
I was thinking about treating the different prototype types like different classes, so we can list all possible attributes. The optional ones will be marked as "(optional)". For each table attribute, it will link to another class with the possible attributes inside it, etc.
I guess this is similar to schema?

Re: Prototype error(s) improvements
Posted: Tue Oct 11, 2016 10:50 am
by mexmer
Mooncat wrote:mexmer wrote:i don't ask for validator, because i believe they use it, i ask for validation schema.
if you know schema, you know which nodes/elementes are required, and which are optional, also for which type.
if you ever worked with it (or similarily with DTD for XML data), you will know what i mean.
other option will be to have "commented" prototype for every entity/item type, but i don't believe that is possible to get, even if we ask 1000 times

Oh! Sorry, I am not familiar with schema. I have heard this term but don't know what is it.
I was thinking about treating the different prototype types like different classes, so we can list all possible attributes. The optional ones will be marked as "(optional)". For each table attribute, it will link to another class with the possible attributes inside it, etc.
I guess this is similar to schema?

that's what is schema about, yes
Re: Prototype error(s) improvements
Posted: Tue Oct 11, 2016 1:32 pm
by aubergine18
Mooncat wrote:There was some time people don't know the "localised_name" attribute exists, because it is not found in vanilla files, and I bet many people still don't know there is also "localised_description". I knew it by accident.
Another hidden attribute I discovered last night (well, 3am this morning as a wild guess to solve an annoyance):
Sets the build sound for placement of entities

Not used once in any of the vanilla protos as far as I can tell, I just guessed what the name might be, tried it and it worked
I'm slowly working my way through the prototypes trying to determine patterns and then writing wrapper objects/scripts as part of one of my many modding projects:
https://github.com/aubergine10/Proto/issues
So far I've found that there are several distinct patterns that apply to all (that I've tested so far) entities, with some fringe patterns that are specific to tech, recipe, item, etc. My goal is to make a something that's akin to CoffeeScript or YAML for prototype definitions, that provides a concise and semantic way of defining and editing them.
Re: Prototype error(s) improvements
Posted: Tue Oct 11, 2016 1:35 pm
by aubergine18
mexmer wrote:if you ever worked with it (or similarily with DTD for XML data), you will know what i mean.
I've worked with XML DTDs but not sure that sort of thing will be implemented in Factorio. I suspect each entity class (and its superclasses) has hard-coded validation on instantiation, data import/export, etc. So probably not something that can be easily published.
Re: Prototype error(s) improvements
Posted: Tue Oct 11, 2016 2:16 pm
by Rseding91
Mooncat wrote:
There was some time people don't know the "localised_name" attribute exists, because it is not found in vanilla files, and I bet many people still don't know there is also "localised_description". I knew it by accident.

But it *is* used by the base game. We use it for technology names and descriptions.
Re: Prototype error(s) improvements
Posted: Wed Oct 12, 2016 1:50 am
by Mooncat
Rseding91 wrote:Mooncat wrote:
There was some time people don't know the "localised_name" attribute exists, because it is not found in vanilla files, and I bet many people still don't know there is also "localised_description". I knew it by accident.

But it *is* used by the base game. We use it for technology names and descriptions.
Oh, then I guess I have missed that.
The problem is we have to see these attributes before we know we can use them. But without being guided by anyone, it is like mission impossible.
I really hope you will consider about the document or schema thingy. (Or at least update and finish the
wiki.)

Re: Prototype error(s) improvements
Posted: Wed Oct 12, 2016 2:42 am
by aubergine18
Even just a list of all the props supported by each prototype type would be super-useful - we will be able to guess what most of them mean. It will mean we can look up an entity and see, with high degree of confidence, what properties that entity supports, without having to look through dozens of definitions for that entity type trying to compile a list which still won't list all the possible properties that type supports.
Re: Prototype error(s) improvements
Posted: Fri Oct 14, 2016 12:04 am
by Impatient
reading this thread my thought was: "Rseding91, have a routine ready that searches the source code and extracts all prototypes and entities and their respective attributes and lists them with their hierarchy in a text file. and ship that file with every version of factorio."
this way it would at least be documented what is there. not how it works though.
Re: Prototype error(s) improvements
Posted: Fri Oct 14, 2016 12:59 am
by Rseding91
Impatient wrote:reading this thread my thought was: "Rseding91, have a routine ready that searches the source code and extracts all prototypes and entities and their respective attributes and lists them with their hierarchy in a text file. and ship that file with every version of factorio."
this way it would at least be documented what is there. not how it works though.
If it was that simple I would have done it by now

Re: Prototype error(s) improvements
Posted: Fri Oct 14, 2016 1:49 pm
by aubergine18
Code: Select all
Error while loading entity prototype "stone-well" (storage-tank):
conversion of data to type "i" failed
Caused by setting `tile_width = 2.5` on a `storage-tank` entity prototype. Error doesn't give any indication as to which _property_ was causing it.
Re: Prototype error(s) improvements
Posted: Fri Oct 14, 2016 2:05 pm
by Rseding91
aubergine18 wrote:Code: Select all
Error while loading entity prototype "stone-well" (storage-tank):
conversion of data to type "i" failed
Caused by setting `tile_width = 2.5` on a `storage-tank` entity prototype. Error doesn't give any indication as to which _property_ was causing it.
Are you on Windows or Mac/Linux?
If I remember correctly Mac has a bug where it fails to properly parse values and you get that weird error. Windows just does the conversion.
Re: Prototype error(s) improvements
Posted: Fri Oct 14, 2016 2:35 pm
by aubergine18
Late 2012 iMac.
Re: Prototype error(s) improvements
Posted: Fri Oct 14, 2016 11:58 pm
by aubergine18
Code: Select all
Error Util.cpp:57: Error while loading entity prototype "wood-pipe-ground" (pipe-to-ground):
No such node (filename)
So, I know I've got a `filename` property missing in my `pipe-to-ground`, but the problem is I don't know what the parent property is.
I've checked my `pipe_covers` (north, east, south, west) - all present and correct. I've checked the `pictures` (up, right, down, left) - all present and correct. I've checked the `vehicle_impact_sound` and the `underground_sprite` and the `icon` - all present and correct. At least as far as I can tell. Without knowing which specific parent property the missing `filename` relates to, I'm left scratching my head, especially considering I'm using same proto structure as the vanilla pipe-to-ground...
Re: Prototype error(s) improvements
Posted: Tue Oct 18, 2016 4:15 am
by aubergine18
Code: Select all
Error while trying to copy data.raw: Can't copy object of type function
If possible indicate which lua script is generating the error?
Re: Prototype error(s) improvements
Posted: Tue Oct 18, 2016 9:33 pm
by keyboardhack
Impatient wrote:reading this thread my thought was: "Rseding91, have a routine ready that searches the source code and extracts all prototypes and entities and their respective attributes and lists them with their hierarchy in a text file. and ship that file with every version of factorio."
this way it would at least be documented what is there. not how it works though.