Fractal Block World
Version 1.01.28 API Changes
Back
Several functions have been added to the API
in this version.
However here will focus on API functions that
were removed and replaced by better solutions.
Deprecated, Changed, or Improved Game API Functions
- If you want, you can prefix the chunk generation API functions
you call with "
gen_
". So you could call gen_set_pos
instead of set_pos, for example.
This is useful to distinguish between the different APIs
when searching for names in your code.
- The "genesis bool" is no longer hardcoded into the engine.
It is now stored in the global variable "game.globals.worldgen.state.genesis".
These variables can be accessed by procedural world generation code.
Variables that start with
"
game.globals.worldgen.state
"
are called "mutators".
Like all other game globals, you declare these in the "globals.txt" file
of your packge.
The old way to access the genesis bool from game code
(not worldgen code) was to call the function
ga_genesis
.
That function is now deprecated (so do not call it).
- We are keeping the functions
ga_block_get
and
ga_get_cocoon_block_of_chunk
which get the block type (bt
)
of a block and a chunk respectively.
However we added new functions whose names are easier to remember:
-
ga_bp_to_bt
-
ga_chunk_id_to_bt
-
ga_vcp_to_bt
.
We encourage the modder to use these new functions instead
for better readability.
- Pink rings
have been completely removed from the engine,
and are now softcoded in Lua as part of the base package.
There is still a pink ring and pink sphere basic entity
Lua script in Data/Packages/base and they function the same
way they did before.
The game API functions involving pink rings and pink spheres
have been replaced by functions in the file
Data/Packages/base/Game/game_base_tele_pink.lua
The game API functions ga_tele_pink
and ga_tele_pink2
have been replaced by the Lua function
game_base_tele_pink.tele
.
Also, you can call the Lua function
game_base_tele_pink.get_pink_dest_chunk_id
to get the chunk id of where pink rings will take you.
- Blue rings
have been completely removed from the engine,
and are now softcoded in Lua as part of the base package.
This was much more complicated than softcoding Pink rings.
One addition to the engine to make this possible is
"dynamic variables" which can be added to the chunk
being procedurally generated during procedural world generation.
What makes them "dynamic" is that they do not need to be
declared ahead of time when the block TYPE is being initialized.
The second technical addition to the engine is the game API function
called ga_explore_while
.
This effectively puts the engine into a "while loop".
When we call the function ga_explore_while
, we pass it the
name of a Lua function f
to be called every frame
until f
returns false.
This function f
is needed to guide the
teleportation.
Between calls to the function f
,
the engine does exploration (it creates and destroys chunks).
The game API functions ga_tele_blue
and ga_tele_blue2
have been replaced by the Lua function
game_base_tele_blue.start_tele
.
To make blue teleportation fast, we use the new API function
ga_render_skip_next_frame
to not render the next frame.
This speeds up the teleportation by a factor of at least 3.