[API Intro] What is a prototype?
Posted: Sat Feb 09, 2019 9:10 pm
For example:
Factorio API - Latest - LuaEntityPrototype
https://lua-api.factorio.com/latest/Lua ... otype.html
The full description is that this is "The prototype of an entity."
What exactly does this mean? No further detail seems to be available.
What is the purpose of a prototype? What does it do? What would not having it do?
,
My guess is that the game has its hardcoded initial values for how the game objects/entities should work. But rather than always creating new objects from the hardcoded data, it instead is "preloading" these initial hard values into this prototype object, which sits in memory like a template, and is from which all else is created.
Although the hardcoded initial values cannot be changed except via a mod, the running game may apparently be able to modify the template/prototype of an entity, so that all further objects created of that type, will have the customized settings of the prototype.
Or am I totally wrong here?
Factorio API - Latest - LuaEntityPrototype
https://lua-api.factorio.com/latest/Lua ... otype.html
The full description is that this is "The prototype of an entity."
What exactly does this mean? No further detail seems to be available.
What is the purpose of a prototype? What does it do? What would not having it do?
,
My guess is that the game has its hardcoded initial values for how the game objects/entities should work. But rather than always creating new objects from the hardcoded data, it instead is "preloading" these initial hard values into this prototype object, which sits in memory like a template, and is from which all else is created.
Although the hardcoded initial values cannot be changed except via a mod, the running game may apparently be able to modify the template/prototype of an entity, so that all further objects created of that type, will have the customized settings of the prototype.
Or am I totally wrong here?