Prototype error(s) improvements

Place to post guides, observations, things related to modding that are not mods themselves.
User avatar
mexmer
Filter Inserter
Filter Inserter
Posts: 870
Joined: Wed Aug 03, 2016 2:00 pm
Contact:

Re: Prototype error(s) improvements

Post 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. 8-)

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 :D
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: Prototype error(s) improvements

Post 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 :D
Oh! Sorry, I am not familiar with schema. I have heard this term but don't know what is it. :oops:
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? :mrgreen:
User avatar
mexmer
Filter Inserter
Filter Inserter
Posts: 870
Joined: Wed Aug 03, 2016 2:00 pm
Contact:

Re: Prototype error(s) improvements

Post 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 :D
Oh! Sorry, I am not familiar with schema. I have heard this term but don't know what is it. :oops:
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? :mrgreen:
that's what is schema about, yes
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Prototype error(s) improvements

Post 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. 8-)
Another hidden attribute I discovered last night (well, 3am this morning as a wild guess to solve an annoyance):

Code: Select all

build_sound = <sound table>
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.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Prototype error(s) improvements

Post 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.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14616
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Prototype error(s) improvements

Post 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. 8-)
But it *is* used by the base game. We use it for technology names and descriptions.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: Prototype error(s) improvements

Post 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. 8-)
But it *is* used by the base game. We use it for technology names and descriptions.
Oh, then I guess I have missed that. :shock:
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. :roll:
I really hope you will consider about the document or schema thingy. (Or at least update and finish the wiki.) :P
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Prototype error(s) improvements

Post 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.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Prototype error(s) improvements

Post 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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14616
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Prototype error(s) improvements

Post 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 :)
If you want to get ahold of me I'm almost always on Discord.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Prototype error(s) improvements

Post 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.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14616
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Prototype error(s) improvements

Post 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.
If you want to get ahold of me I'm almost always on Discord.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Prototype error(s) improvements

Post by aubergine18 »

Late 2012 iMac.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Prototype error(s) improvements

Post 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...
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Prototype error(s) improvements

Post 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?
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: Prototype error(s) improvements

Post 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.
Waste of bytes : P
Post Reply

Return to “Modding discussion”