User:TOGoS: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Move noise expression work to my user page)
(Remove noise expressions)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Hi, I'm TOGoS!  I'm mostly trying to open up the terrain generation so that it can be hacked on (by staff or modders) without having to embed oneself in the C++ guts of factorio for several weeks.
Hi, I'm TOGoS!  I'm mostly trying to open up the terrain generation so that it can be hacked on (by staff or modders) without having to embed oneself in the C++ guts of factorio for several weeks.
= Types/NoiseExpression =
== Basics ==
A fragment of a functional program used to generate coherent noise, probably for purposes related to terrain generation.
== Mandatory properties ==
=== type ===
'''Type''': [[Types/string]]
Name of the type of this expression.
Which other properties apply depend on the expression type.
== Expression types ==
=== variable ===
Reference to a pre-defined variable, constant, or a named noise expression.
Predefined variables include "x", "y", and "distance".
Properties:
* '''variable_name''': a [[Types/string]]
=== function-application ===
Apply a function to a list or associative array of arguments.
Some functions expect arguments to be named and some expect them not to be.
Function calls are their own class of expression
(as opposed to every function just being its own expression type)
because function calls all have similar properties --
arguments are themselves expressions,
a call to any pure function (i.e. most functions other than <code>random()</code>)
is [https://en.wikipedia.org/wiki/Referential_transparency referentially transparent]
and can be constant-folded if all of its arguments are constant, etc.
Properties:
* '''function_name''' (a string; see functions, below)
* '''arguments''' (a list or associative array of argument expressions)
=== literal-number ===
Evaluates to the same number every time, given by the '''literal_value''' property.
=== literal-string ===
Evaluates to the same stringevery time, given by the '''literal_value''' property.
Since the noise generation runtime has no notion of strings or use for them,
this is useful only in constant contexts.
=== literal-object ===
Evaluates to the same object every time, given by the '''literal_value''' property.
e.g.
<pre>
{
  type = "literal-object",
  literal_value = {
    name = "Bob Hope",
    birth_date = {
      year = 1903,
      month = 5,
      day_of_month = 29
    }
  }
}
</pre>
Since the noise generation runtime has no notion of objects or use for them,
this is useful only in constant contexts, such as the '''points''' argument
of the '''distance-from-nearest-point''' function.
== Functions ==
=== add ===
=== subtract ===
=== multiply ===
=== divide ===
=== exponentiate ===
=== absolute-value ===
=== clamp ===
=== ridge ===
=== factorio-basis-noise ===
=== factorio-multioctave-noise ===

Latest revision as of 16:28, 1 September 2018

Hi, I'm TOGoS! I'm mostly trying to open up the terrain generation so that it can be hacked on (by staff or modders) without having to embed oneself in the C++ guts of factorio for several weeks.