factoriax.engine.envs.easy_rocket#
The Easy Rocket scenario: a small recipe book for eight machines and a rocket.
Module Attributes
The achievement bits in curriculum order, each one with a stable name. |
|
Stable name of each bit, in curriculum order, for the display and the log. |
|
|
- factoriax.engine.envs.easy_rocket.EASY_ROCKET_ACHIEVEMENTS: tuple[Achievement, ...] = (Achievement(id='mine_1_ore', condition=<function _has_any_raw_ore>, name='mine_1_ore', hint='', weight=1.0), Achievement(id='mine_3_ore', condition=functools.partial(<function _has_n_raw_ore_types>, n=3), name='mine_3_ore', hint='', weight=1.0), Achievement(id='prospector', condition=<function _has_each_raw_ore>, name='prospector', hint='', weight=1.0), Achievement(id='place_miner', condition=functools.partial(<function _has_machine>, machine=1), name='place_miner', hint='', weight=1.0), Achievement(id='place_3_miners', condition=functools.partial(<function _has_n_machines>, machine=1, n=3), name='place_3_miners', hint='', weight=1.0), Achievement(id='metal_in_motion', condition=functools.partial(<function _has_n_machines>, machine=1, n=6), name='metal_in_motion', hint='', weight=1.0), Achievement(id='automated_mining', condition=<function _any_producing_miner>, name='automated_mining', hint='', weight=1.0), Achievement(id='ore_fields', condition=<function _distinct_producing_ore_types>, name='ore_fields', hint='', weight=1.0), Achievement(id='mining_master', condition=<function _all_ore_types_covered>, name='mining_master', hint='', weight=1.0), Achievement(id='one_pallet', condition=functools.partial(<function _has_n_machines>, machine=2, n=1), name='one_pallet', hint='', weight=1.0), Achievement(id='three_pallets', condition=functools.partial(<function _has_n_machines>, machine=2, n=3), name='three_pallets', hint='', weight=1.0), Achievement(id='stacked', condition=functools.partial(<function _has_n_machines>, machine=2, n=6), name='stacked', hint='', weight=1.0), Achievement(id='assembler_online', condition=functools.partial(<function _has_machine>, machine=4), name='assembler_online', hint='', weight=1.0), Achievement(id='assembler_and_arm', condition=functools.partial(<function _has_n_machines_pair>, machine_a=4, machine_b=5, n=1), name='assembler_and_arm', hint='', weight=1.0), Achievement(id='one_belt', condition=functools.partial(<function _has_n_machines>, machine=3, n=1), name='one_belt', hint='', weight=1.0), Achievement(id='three_belts', condition=functools.partial(<function _has_n_machines>, machine=3, n=3), name='three_belts', hint='', weight=1.0), Achievement(id='hull_production', condition=functools.partial(<function _assembler_outputs_item>, item=19), name='hull_production', hint='', weight=1.0), Achievement(id='two_assemblers', condition=functools.partial(<function _has_n_machines>, machine=4, n=2), name='two_assemblers', hint='', weight=1.0), Achievement(id='an_arm_and_a_leg', condition=functools.partial(<function _has_n_machines_pair>, machine_a=4, machine_b=5, n=2), name='an_arm_and_a_leg', hint='', weight=1.0), Achievement(id='six_belts', condition=functools.partial(<function _has_n_machines>, machine=3, n=6), name='six_belts', hint='', weight=1.0), Achievement(id='engine_production', condition=functools.partial(<function _assembler_outputs_item>, item=20), name='engine_production', hint='', weight=1.0), Achievement(id='auto_bots', condition=functools.partial(<function _has_n_machines>, machine=4, n=3), name='auto_bots', hint='', weight=1.0), Achievement(id='belt_spaghetti', condition=functools.partial(<function _has_n_machines>, machine=3, n=10), name='belt_spaghetti', hint='', weight=1.0), Achievement(id='rocket_assembled', condition=functools.partial(<function _assembler_outputs_item>, item=29), name='rocket_assembled', hint='', weight=1.0), Achievement(id='liftoff', condition=functools.partial(<function _has_machine>, machine=6), name='liftoff', hint='', weight=1.0))#
The achievement bits in curriculum order, each one with a stable name. This tuple is the one definition of the bit set. The condition tuple, the public name list, and
NUM_EASY_ROCKET_ACHIEVEMENTSall come from it. A hand-skill bit reads the player inventory. A production bit reads a machine buffer, so a hand craft cannot unlock one. The four sections are raw ore, hulls, engines, and final assembly.
- factoriax.engine.envs.easy_rocket.EASY_ROCKET_ACHIEVEMENT_NAMES: tuple[str, ...] = ('mine_1_ore', 'mine_3_ore', 'prospector', 'place_miner', 'place_3_miners', 'metal_in_motion', 'automated_mining', 'ore_fields', 'mining_master', 'one_pallet', 'three_pallets', 'stacked', 'assembler_online', 'assembler_and_arm', 'one_belt', 'three_belts', 'hull_production', 'two_assemblers', 'an_arm_and_a_leg', 'six_belts', 'engine_production', 'auto_bots', 'belt_spaghetti', 'rocket_assembled', 'liftoff')#
Stable name of each bit, in curriculum order, for the display and the log. A training run writes these as metric keys.
CAUTION: Treat these names as a wire format, the same as the bit order. A new name breaks every log that an earlier run wrote.
- factoriax.engine.envs.easy_rocket.build_easy_rocket_level(key: Array) Level#
Build a 16x16 easy-rocket level with six 2x2 ore patches from a PRNG.
The patches do not overlap each other. They stay clear of the outer one-cell dirt ring, and clear of the 4x4 zone that covers the 2x2 spawn area and its one-cell inner ring. The same key returns equal levels, and two different keys give two different layouts.
factoriax.engine.envs.common.six_patch_terrain()is the JAX-native version of this function.- Parameters:
key – PRNG key for the patch placement. The function runs on the host, so JAX cannot trace it. Call it before you enter
jit.- Returns:
A 16x16 level with six 2x2 ore patches. The same key always returns an equal level.
- Return type:
- factoriax.engine.envs.easy_rocket.easy_rocket(*, obs: str = 'superficial_global', obs_radius: int = 7) tuple[FactoriaxEnv, EnvParams]#
Build the EasyRocket-v1 environment, with its achievement hook and reward.
The function binds the keyed generator as
terrain_fn, so each episode gets a new layout. It binds the production achievement conditions as a step hook, and the achievement reward asreward_fn.max_machinesis 100, which keeps the entity arrays large enough for a full 16x16 factory. Such a factory holds about 80 entities at its largest.- Parameters:
obs – Observation variant. The function passes it to
FactoriaxEnv.obs_radius – Half-width of the local observation window.
- factoriax.engine.envs.easy_rocket.easy_rocket_conditions(state: EnvState) Array#
The bits walk a production curriculum of four sections: raw ore, hulls, engines, and final assembly. An automated-production bit reads a buffer inside a machine, and only the simulation fills such a buffer. A hand action writes to the player inventory, so a hand craft cannot unlock those bits.
- factoriax.engine.envs.easy_rocket.easy_rocket_reward(prev_state: EnvState, new_state: EnvState, params: EnvParams) Array#
Score a step by the EasyRocket achievements that it unlocked.
- Parameters:
prev_state – State just before the step.
new_state – State just after the step.
params – The function does not read this argument. It is present for the shared reward signature.
- Returns:
Scalar float32, the weighted sum of the achievements that this step unlocked. The value is zero on most steps.
- Return type: