The Archean Wiki is a good resource for anyone looking to dive deep into the game, providing information on every component and mechanics available.

This documentation is still under development, feel free to contact us if you have any questions or suggestions.


Game Overview

Archean invites you to unleash your creativity alone or with friends in a creative sandbox mode.
Design and build vehicles, bases, rockets, space stations and much more using customizable modular blocks.
Create unique configurations using components, program their behavior and explore an environment free of constraints.
Test your builds, refine your designs and defy the laws of physics.
Archean is a game in development focused on engineering and build.

Main Features

- Advanced Engineering System
Build ground bases, rovers, spacecrafts, space stations, motherships, airplanes... manage their systems, power, fuel, electronics...

- Open world
Do whatever you want, you’re not forced into any specific path.

- Space Sim
This is also a realistic space sim with orbital mechanics, proper space physics and seamless transitions between planets.

- Solo or Multiplayer
Play and build in solo, with your friends or on public servers.

- Ray-Tracing
Our renderer is fully ray-traced using modern RTX technologies.

- First person
This game is meant to be immersive, the optional third person view works fine but is mostly for screenshots.

- Creative mode
Build anything you can imagine, with unlimited resources. A survival mode is planned for the future.

- Ship interiors
Of course, you designed and built it. Please make it look nice!

- Space-legs anywhere
Walk inside your ship, walk on the surface of planets, or float in space.

- Realistic aerodynamics
Aerodynamic forces are realistically simulated based on the shape of your build.

- Realistic planet sizes and distances
You won't ever be able to explore the whole "map".

- Real-time orbital mechanics
Planets and moons orbit each other and you can orbit them at realistic velocities, even while docking on your friend's ship.

- Realistic gravity simulation
Want artificial gravity? You can use constant acceleration or centrifugal forces... just don't vomit in your helmet.

- Travel speeds up to 0.99 C
High relativistic speeds, no artificial limits, just keep accelerating... but don't forget to slow down before crashing into a planet.

- Per-server configuration
Each server make their own rules, star systems and enabled mods.

- Detailed procedural planet terrain
High resolution terrain with fully procedural rocks.

- Water and Oceans
You want to build a boat or a submarine, sure why not!?

- In-game coding
Our own in-game programming language and a more player-friendly Node-based visual programming system.

- Moddable out-of-the-box
If you’re good with C++, we will soon expose an SDK where anything is possible.

Installation

Minimum System Requirements

  • NVIDIA RTX Graphics Card with the latest drivers
  • Microsoft Windows 10 or 11 or a modern Linux distribution

Download

After obtaining your copy of the game, download the installer for Windows or GNU Linux from https://archean.space/. Log in to your account and click on the download logo at the top of the site as shown below.

Download

Installation

Installing the launcher is like installing any standard program; double-click the executable and follow the instructions. After installing and executing the launcher on your system, it will automatically download or update the game files.


AMD NOT SUPPORTED

The game currently DOES NOT work with AMD graphics cards because of bugs in their drivers related to Ray-Tracing. Stay tuned for updates in our discord server if you want to be informed when this situation changes.

Bug Reports

Archean is under development, both in terms of the launcher and the game itself.
You may encounter bugs that vary in nuisance, and we pay close attention to fixing them.

To report any issues experienced, we strongly encourage you to do so in the #bug-reports channel on our Discord

Game modes

In Archean, there are different game modes. Each game mode has its own rules and objectives based on the type of player you are.

Creative

In creative mode, you have access to all the blocks and items in the game directly in your inventory. You can freely build any structures and vehicles you want. Here are the specific characteristics of creative mode:

  • Blueprints can be loaded without having the necessary components.
  • The OwnerPad checkpoint system saves the state of batteries and tanks.
  • The respawn shortcut accessible via the F10 key allows you to respawn without dropping the contents of your inventory.
  • Mining and crafting are available, but not necessary for building structures or vehicles.
  • You can reset your inventory using the RESET button available at the top of your inventory.

Adventure

In adventure mode, you start with an empty inventory and must collect resources to craft the necessary components for building structures and vehicles. Here are the specific characteristics of adventure mode:

  • Blueprints cannot be loaded without having the necessary components in your inventory.
  • The OwnerPad checkpoint system does not restore the state of batteries and tanks.
  • The respawn shortcut accessible via the F10 key drops the contents of your inventory in a box at your location before the respawn.
  • Mining and crafting are necessary for building structures or vehicles.

Survival

The survival mode is not yet available in the game. It will be added in a future update.

ItemConstructorTool
ModuleARCHEAN_build

Description

The constructor tool is the primary tool used for building in Archean. It enables you to add or remove frames and blocks of various shapes.

Usage

You can enable tooltips to guide you in using the constructor tool through the help / settings menu accessible via the F1 key. These tooltips will provide you with information on the different actions possible with the constructor tool depending on the selected mode.

ItemDashboardTool
ModuleARCHEAN_build

Description

The dashboard tool is used to design dashboards with smaller components in a more flexible manner.

Usage

You can enable tooltips to guide you in using the dashboard tool through the help / settings menu accessible via the F1 key. These tooltips will provide you with information on the different actions possible with the dashboard tool depending on the selected mode.

ItemDestructorTool
ModuleARCHEAN_build

Description

The destructor is a tool that, when equipped, allows the player to delete targeted components.

Usage

Hold Right click to activate the destruction mode. Left click on the component to destroy it.


  • You cannot destroy cables, blocks or beams with this tool.
  • You cannot delete a seat if it is occupied by a player.
  • If an OwnerPad had been added, you must have the Build permission to destroy a component.

ItemPaintTool
ModuleARCHEAN_build

Description

The Paint Tool is a tool that allows you to paint blocks, cables, labels or components in different colors.

Usage

  • To display the Paint Tool configuration menu, you must hold the C key.
  • You can change the material type using the mouse wheel.
  • You can choose the color by moving the mouse cursor over the desired color.
  • The left click is used to paint components or blocks.
  • The right click is used to pick a color (from blocks only).

  • Components can have up to two paintable zones.
  • Applying a color to a block is done per face.

ItemLabelTool
ModuleARCHEAN_build

Description

The Label Tool is a tool for placing small plates on blocks to display information in the form of text.

Usage

  • Left click on a block to place a new label.
  • You can edit the size and text of a label by targeting it and pressing the V key.

ItemBlueprintTool
ModuleARCHEAN_build

Description

The Blueprint Tool allows you to save a copy of an build. Blueprints are saved in the (Client Settings)/blueprints folder in .json format, one per blueprint with it's respective name.

With this system, you can transfer your builds to other worlds or servers, share them with friends or simply duplicate a build.

Usage

  • Left-click to scan and save a blueprint of the target build.
  • Right-click to open the interface displaying your blueprints.

To spawn a blueprint, you need to open the blueprint interface and select the desired blueprint.
You can then freely move the selection using a hologram of your selected blueprint. A long left-click will spawn it, while a right-click will cancel the operation and go back to scan mode.

You may also spawn a blueprint on top of an existing build to add the parts to it by quickly pressing left-click before making finer adjustments.
Once you're happy with how it's placed, you can hold left-click for two seconds to permanently spawn it, merged with the target build.


  • If an OwnerPad has been added, you must have the "Build" permission to save a blueprint of the build you're aiming.

ItemSpool
ModuleARCHEAN_build
Length100 m

Description

The different spools allow connecting components to transfer data, energy, items or fluids.

Usage

Creating a cable (connecting two components)

The creation of a cable starts and ends on a component connector.

The placement of cables is completely free and allows adding as many points as you want (as long as you spool's remaining length) to customize its shape. During the creation of a cable, if you have placed multiple points, you can remove points using the right-click to refine the placement or completely cancel the creation of the cable if there are no more existing points.

Cables can be stacked on top of other existing cables and on components. (To snap it on the surface of a component, you must hold the Shift key).

Creating a Flexible Cable

You may want to connect components of different builds together temporarily or simply attach two builds together.
This will effectively create a Flexible cable.
The two builds will effectively be linked together and constrained in the physics engine.
There is no force limit, the cables will not detach.
You can also add a flexible cable between two components of the same build by holding X, to get a straight (maybe a bit curved) cable that will be affected by gravity.

Deleting a cable

You can delete a cable with a right-click as long as the tool in your hand is the appropriate cable spool.


  • When creating your cable, if it refuses to be created, it is likely that you do not have enough available length in your current spool to create the cable.
  • Cables have no transfer limit nor loss related to length.
  • Cables do not determine the direction of what they transport.
  • A cable cannot be modified once placed, you must delete it.
  • Flexible cables will affect performance significantly, whereas normal cables will not affect performance at all even if you have thousands of them in a build. Try to prioritize using normal cables where you can

ComponentComputer
ModuleARCHEAN_computer
Mass10 kg
Size100 x 100 x 50 cm


To learn how to use the computer's programming interface, visit the XenonCode IDE page.

Description

The computer is a component designed to run XenonCode programs to control other components or display various information on its screen.

It has characteristics that determine its power, storage, and memory. These information are visible on the BIOS as shown in the image below.

Bios

BIOS Information:

  • Processor Type: The XPU64-AIO processor refers to this All-In-One computer component type.
  • Frequency: The frequency is the speed at which the computer executes the code of the current program and will match the server's updates_per_second setting (25 ticks per second by default).
  • Max IPC: This parameter is determined by a configuration file and is the maximum number of instructions per cycle before it "crashes" virtually.
  • System RAM: In XenonCode programs, you can store values in volatile variables that reset when the computer restarts or when a program is reloaded. This parameter represents the maximum number of values for all variables of the currently running program.
  • Storage Capacity: Similar to system RAM, there is a storage variable type that stores data on the hard drive permanently until modified. In this case, it is limited to a maximum of 256 values.
  • I/O Ports: This parameter is determined by the components and simply indicates the number of data ports on the computer.

The BIOS is a program that is running by default on every computer when it boots.

In this case, its role is to indicate the characteristics of the computer as well as the list of programs available on the hard drive so that you can select one to execute.

It is possible to customize the BIOS by creating a new file named "main.xc" to modify its appearance or automatically load a program. Please refer to the XenonCode IDE documentation for more information.

Usage

Program:

When a program is created and saved, it will appear in the list of programs on the BIOS. You can select the program to execute using the F key.

Button:

The computer has two physical buttons, the "Code" button that opens the XenonCode IDE for developing your programs, and a "Reboot" button that restarts the computer and re-executes the main.xc program (BIOS).

Power:

To operate, the computer requires a low-voltage power supply. It consumes 30 watts when idle and its consumption can rise up to 500 watts depending on the ratio between the number of instructions executed by the currently running program and the current MAX IPC configured on the server.

HDD:

The Computer has a hard drive bay. You can have multiple HDD in the bay (only one active at a time), swap HDD with other computers or stash them in your inventory. This is useful when you want to move your computer somewhere else without losing your code.


  • The resolution of the integrated screen is 200x160 pixels.
  • The contents of HDDs (your code) is not lost if you destroy a Computer component by mistake. It will still exist in the server's files (or your own computer if you're playing solo). You can find it in (Server Settings)/worlds/(World Name)/ARCHEAN_computer/HDD-... You may even edit the code from there and it will reboot your computer live in the game, if you prefer using an external editor (VSCode actually has a XenonCode extension available)

ComponentMiniComputer
ModuleARCHEAN_computer
Mass5 kg
Size25 x 25 x 50 cm


Description

The MiniComputer is a component designed to run XenonCode programs to control other components. It is a smaller variant of the Computer and does not have a built-in screen.

Usage

Being completely similar in terms of features to the Computer, its usage is almost identical.

The main difference is that the MiniComputer does not have a built-in screen and therefore cannot display a BIOS that lists the available programs.

If it contains only one program, it will be loaded automatically. If you want to have multiple programs, you must make a custom BIOS by creating a "main.xc" file to load the program of your choice.

main.xc:

init
	load_program("rover") ; this will load the file "rover.main.xc"

ComponentRouter
ModuleARCHEAN_computer
Mass20 kg
Size100 x 100 x 25 cm


Description

A router is a device used to connect different components to a network. Its main advantage is the ability to connect a practically unlimited number of components, all controllable by one or more computers on the network. In contrast, an individual computer's ability to connect to components is limited by its number of available ports.

Each router is equipped with 30 data ports. They can be chained to increase the total number of available ports, thus multiplying the ports by the number of routers connected together.

It requires a low-voltage power supply to operate and consumes 50 watts.

Usage

When the router is powered on and connected to components, it allows assigning aliases to components via a three-dimensional visual interface, which can later be used to identify these components from computer code.

You can open the router interface using the F key. The interface appears as a 3D environment (see image below) in which you can navigate using the standard movement keys and right-click of the mouse to locate the different connected components. The components are positioned at their actual 3D position relative to each other in the build, and will include all connected components from all routers in the chain.

Router

Each component displays a label where you can enter the alias that will be used later on a computer. To learn how to use aliases, refer to the XenonCode IDE page.

It is possible to assign an alias to a component directly by displaying its information window using the V key, as shown in the example below.

Router

ComponentDataJunction
ModuleARCHEAN_junction
Mass1 kg
Size25 x 25 x 25 cm


Description

The data junction allows for the transmission of data from a single port to four different ports, to broadcast data to multiple components. It operates in a unidirectional manner, hence you cannot read back from it.

ComponentDataBridge
ModuleARCHEAN_junction
Mass1 kg
Size25 x 25 x 25 cm


Description

The Data Bridge is a component that simply allows the relocation of a Data end point to another position.

Usage

When placing a Data Bridge, arrows appear on the hologram that determine the direction of operation. Typically, the incoming arrow should be connected to a computer, button... etc., while the outgoing arrow should be connected to the component to be controlled or to read data from.

ComponentPushButton
ModuleARCHEAN_hid
Mass1 kg
Size25 x 25 x 25 cm


Description

The push button constantly sends a value of 1 while it is pressed otherwise 0.

Usage

The button is activated with the F key and will remain active as long as the key is held down.

ComponentToggleButton
ModuleARCHEAN_hid
Mass1 kg
Size25 x 25 x 25 cm


Description

The switch button constantly sends a value of 1 when activated, otherwise 0.

Usage

The F key is used to toggle the Toggle Button.

ComponentThrottleLever
ModuleARCHEAN_hid
Mass1 kg
Size25 x 25 x 50 cm


Description

The Throttle Lever is a type of control that constantly sends an analog value between -1.0 and +1.0 depending on the position of the lever.

Usage

The lever is controlled with the mouse by holding the F key and moving the mouse up/down.

There is resistance in the center of the lever to help find the precise center position.


Tip

You can use a function in a computer to give it a classic accelerator behavior, where the low position returns 0 and the high position returns 1.

; Where `a` is the throttle output
(a+1)/2

ComponentPilotSeat
ModuleARCHEAN_avatar
Mass50 kg
Size75 x 75 x 175 cm


Description

The Pilot Seat allows a player to control (send values on different channels) a component using the bound vehicle controls from a keyboard, controller, or joystick.

Usage

Press R to sit in the seat. Hold R for one second to exit a seat.

While seated, you can move to another nearby seat without needing to exit the current seat using the R key. When exiting a seat, it remembers where you were relative to the build when you entered the seat, and that is where you will be when you exit it.

List of outputs

ChannelFunctionRange
0Using1 if an avatar is seated in the seat, otherwise 0
1Backward/Forward-1.0 to +1.0
2Left/Right-1.0 to +1.0
3Down/Up-1.0 to +1.0
4Pitch-1.0 to +1.0
5Roll-1.0 to +1.0
6Yaw-1.0 to +1.0
7Main Thrust0.0 to 1.0
8Aux 10 or 1
9Aux 20 or 1
10Aux 30 or 1
11Aux 40 or 1
12Aux 50 or 1
13Aux 60 or 1
14Aux 70 or 1
15Aux 80 or 1
16Aux 90 or 1
17Aux 00 or 1

If an OwnerPad is present, you must have the "Sit" permission sit in the seat and Interact to use the controls.

ComponentLowVoltageBattery
ModuleARCHEAN_battery
Mass10 kg
Size50 x 50 x 50 cm


Description

  • Voltage: 44 to 52 volts depending on its current state of charge
  • Current: 1000 amps per port
  • Total capacity: 10 kwh
  • Electrical ports: 4
  • Data port: 1 port for battery status monitoring

Usage

With the battery providing 1000 amps per port, you can get up to 52 kw on each port to power components.

List of outputs

ChannelFunction
0Voltage
1Max Capacity (Wh)
2State of charge
3Throughputs (watts)

ComponentHighVoltageBattery
ModuleARCHEAN_battery
Mass100 kg
Size100 x 100 x 100 cm


Description

  • Voltage: 480 to 500 volts
  • Current: 10,000 amps per port
  • Total capacity: 120 kilowatt-hours
  • Electrical ports: 4
  • Data port: 1 port for battery status monitoring

Usage

With the battery providing 10,000 amps per port, you can get up to 5 MW on each port to power components.

List of outputs

ChannelFunction
0Voltage
1Max Capacity (Wh)
2State of charge
3Throughputs (watts)

ComponentLowVoltageJunction
ModuleARCHEAN_junction
Mass1 kg
Size25 x 25 x 25 cm


Description

The low voltage junction allows distributing energy to 4 ports to provide power to multiple components from a single power source.

The low voltage junction does not allow combining energy by using it in reverse, it works in one direction only. The available power is effectively split based on the number of connected devices in its output ports.

ComponentHighVoltageJunction
ModuleARCHEAN_junction
Mass1 kg
Size25 x 25 x 25 cm


Description

The high voltage junction allows distributing energy to 4 ports to provide power to multiple components from a single power source.

The high voltage junction does not allow combining energy by using it in reverse, it works in one direction only. The available power is effectively split based on the number of connected devices in its output ports.

ComponentLowVoltageBridge
ModuleARCHEAN_junction
Mass1 kg
Size25 x 25 x 25 cm


Description

The Low Voltage Bridge is a component that simply allows the relocation of a low voltage end point to another position.

ComponentHighVoltageBridge
ModuleARCHEAN_junction
Mass1 kg
Size25 x 25 x 25 cm

Description

The High Voltage Bridge is a component that simply allows the relocation of a High voltage end point to another position.

ComponentLowVoltageRelay
ModuleARCHEAN_junction
Mass1 kg
Size25 x 25 x 25 cm


Description

The low voltage relay is a device that powers a component by allowing the current to flow only if a non-zero signal value is sent to its data port.

The face with two ports is intended for connecting the power source and the data port.

The energy output is located on the face with a single port.

ComponentHighVoltageRelay
ModuleARCHEAN_junction
Mass1 kg
Size25 x 25 x 25 cm


Description

The high voltage relay is a device that powers a component by allowing the current to flow only if a non-zero signal value is sent to its data port.

The face with two ports is intended for connecting the power source and the data port.

The energy output is located on the face with a single port.

ComponentPowerConverter
ModuleARCHEAN_junction
Mass1 kg
Size25 x 25 x 25 cm


Description

The power converter is a device that converts high voltage energy to low voltage energy and vice versa.

This device is useful, for example, to power a computer from a high voltage battery if ports are available and to avoid adding a low voltage battery. However, if you want to power a high voltage component from a low voltage battery, you will of course still be limited in terms of total power output based on the low voltage battery's output.

ComponentSolarPanel
ModuleARCHEAN_celestial
Mass25 kg
Size200 x 200 x 25 cm


Description

The solar panel generates low voltage energy. It has an efficiency of 99.9% and a surface area of 4 square meters (2x2 meters). The power output will be limited based on its distance and orientation to the sun(s). With the default solar system configuration in Archean, the sun is only about 25% as bright as our actual sun. On Archean's Earth inside the atmosphere in the best circumstances, you might be able to generate up to ~ 980 watts per panel.

Usage

Connect the solar panel to the component that requires low voltage energy to function.

The solar panel has two electrical ports, which allows you to connect two components simultaneously or chain multiple solar panels in series to increase the total available power.

List of outputs

ChannelFunction
0Generated Power (Watts)
1Output Power (Watts)

If you are using the solar panel to power two components, the total power distributed across the two ports cannot exceed the panel's output power.

If one of the two components wants to consume the entire available power from the panel, it may prevent the other component to use any power at all. It is better to use power junctions in this case, to make sure all components get fed with power.

ComponentRTG
ModuleARCHEAN_rtg
Mass50 kg
Size50 x 50 x 100 cm


Description

The radioisotope thermoelectric generator (RTG) generates low-voltage energy. It can provide a continuous power depending on the cooling ability of the environment.

Usage

Connect the RTG to the component that requires low-voltage energy to function.

The RTG has two electrical ports, which allows you to connect two components simultaneously or chain multiple RTGs to increase the total power output.

  • Currently, the RTG provides unlimited energy and does not have any harmful effects on the player or the environment.

  • If you are using the RTG to power two components, the total power distributed across the two ports cannot exceed the RTG's available output power.

  • If one of the two components wants to consume the entire available power from the RTG, it may prevent the other component to use any power at all. It is better to use power junctions in this case, to make sure all components get fed with power equally.

ComponentSmallFluidTank
ModuleARCHEAN_tank
Mass30 kg
Size50 x 50 x 100 cm


Description

The small fluid tank is a component that allows storing all types of fluids.

Total capacity: 0.20 m³

The data port returns a number between 0.0 and 1.0 that determines the current fill level of the tank.

ComponentFluidTank
ModuleARCHEAN_tank
Mass200 kg
Size100 x 100 x 200 cm


Description

The fluid tank is a component that allows storing all types of fluids.

Total capacity: 1.50 m³

The data port returns a number between 0.0 and 1.0 that determines the current fill level of the tank.

ComponentBigFluidTank
ModuleARCHEAN_tank
Mass1000 kg
Size250 x 250 x 250 cm


Description

The big fluid tank is a component that allows storing all types of fluids.

Total capacity: 14 m³

The data port returns a number between 0.0 and 1.0 that determines the current fill level of the tank.

ComponentSmallTurboPump
ModuleARCHEAN_thruster
Mass25 kg
Size25 x 25 x 50 cm


Description

The Small Turbo pump is a component used to transfer high-density fluid up to 10 kg per second.

Usage

The pump has two fluid ports, one on each side, marked by colors:

  • Blue corresponds to the input
  • Red corresponds to the output

Power Supply

To use the pump, it needs to be powered by high-voltage. It consumes up to 10 kw when running at full speed.

Data

The data port allows controlling the pump speed by sending a value between -1 and 1. When the pump is connected to a computer, it can also retrieve the current flow rate.

When sending a negative value, the pump will effectively run in reverse.

ComponentBigTurboPump
ModuleARCHEAN_thruster
Mass200 kg
Size50 x 50 x 150 cm


Description

The Big Turbo pump is a component used to transfer high-density fluid up to 100 kg per second.

Usage

The pump has two fluid ports, one on each side, marked by colors:

  • Blue corresponds to the input
  • Red corresponds to the output

Power Supply

To use the pump, it needs to be powered by high-voltage. It consumes up to 100 kw when running at full speed.

Data

The data port allows controlling the pump speed by sending a value between -1 and 1. When the pump is connected to a computer, it can also retrieve the current flow rate.

When sending a negative value, the pump will effectively run in reverse.

ComponentElectrolyser
ModuleARCHEAN_chemical
Mass500 kg
Size100 x 100 x 200 cm


Documentation coming soon

ComponentFluidJunction
ModuleARCHEAN_junction
Mass20 kg
Size25 x 25 x 100 cm


Description

The Fluid Junction is a component that allows for the separation or combination of fluids.

Usage

The Fluid Junction transfers fluids with the logic shown in the example image below. The ports on the face that contains 4 ports only communicate with the port on the face that contains only one.

When fluid enters through the bottom port, it is divided based on the number of connected components on the top.

ComponentFluidBridge
ModuleARCHEAN_junction
Mass1 kg
Size25 x 25 x 25 cm


The Fluid Bridge is a component that simply allows the relocation a fluid end point to another position.

ComponentFluidPort
ModuleARCHEAN_chemical
Mass1 kg
Size25 x 25 x 25 cm


Description

The fluid port is a device that allows for the suction or ejection of fluids.

When pulling in fluid, it will draw in the composition of the surrounding environment. For example, if it is submerged in water, it can fill a fluid tank with H2O, and if it is in the open air, it will draw in the composition of the atmosphere.

When pushing out fluid, it can purge fluid tanks of their contents.

Usage

The fluid port acts as a bridge between a fluid container and the composition of the surrounding environment.

To operate, it needs to be connected to any component capable of holding or processing fluids.

Below is an example illustrating how it could be connected.

FluidPortDemo

ComponentItemJunction
ModuleARCHEAN_junction
Mass20 kg
Size25 x 25 x 100 cm


Documentation coming soon

ComponentMiningDrill
ModuleARCHEAN_celestial
Mass400 kg
Size200 x 200 x 100 cm


Description

The Mining Drill is a component that allows drilling the terrain to extract rocks that can be crushed to obtain ores.

Usage

To function, it needs to be installed on a build that must be anchored to the ground using a ground anchor. You need to connect it to a Container of anything else that takes in Items, to collect the mined rocks.

Depending on the energy type, it can extract rocks at different speeds.

EnergyPower requiredSpeedDepth
Low Voltage10 kwUp to 10 rocks per second0.01 meter per second
High Voltage100kwUp to 100 rocks per second0.1 meter per second

Efficiency & depletion

The mined area is not unlimited, it gradually depletes as it goes deeper and the efficiency decreases accordingly.
You will have to relocate it once in a while.

List of outputs

ChannelFunction
0Composition
1Depth
2Efficiency
3MiningRate
4DrillingRate

ComponentOreScanner
ModuleARCHEAN_celestial
Mass5 kg
Size50 x 25 x 25 cm


Description

The ore scanner is a component that allows you to retrieve the composition of the terrain at one or more positions (by distance) in the direction of its sensor. It only works on planets and moons and is mainly used to find ores for use in the crafting system.

Usage

From a technical point of view, the scanner is very simple. You send it a number in channel 0 that corresponds to the distance in meters at which you want to scan the terrain, and the scanner will return a text object corresponding to the composition at that distance in the direction of the sensor.

Its strength lies in the ability to send it multiple distances in different channels to scan multiple points simultaneously on each server tick (25 times per second by default).

Example

To scan the terrain at a distance of 10m, you need to send the value 10 in input channel 0. The scanner will return a text object that corresponds to the composition at 10m distance in the corresponding output channel.

To scan the terrain at distances of 10m and 20m, you need to send the value 10 in input channel 0 and the value 20 in input channel 1, for example. The scanner will then return a text object that corresponds to the composition at 10m distance in output channel 0 and another text object for 20m distance in output channel 1.

With these possibilities, you can, for example, use a XenonCode loop to scan all compositions within a range of 100m with a step of 10m and display them in the console.

	repeat 10 ($i)
		output_number($scanner_io, $i, $i*10)
		print(input_text($scanner_io, $i))

Keep in mind that there will be a 1 tick delay between sending to the output and retrieving from the input. Basically, the Scanner will give you the results based on the values you sent it in the previous tick, so don't shuffle your distance values between channels and don't use any random values, try to keep them consistent accross multiple ticks.

Data retrieval

When you have performed a scan, you can retrieve the composition information, which will be in the form of a key-value text object. For example, if you have scanned the terrain at a distance of 10m, you can retrieve a text object in the form .C{0.12}.Fe{0.05}.Si{0.03}.Cu{0.80}, which means that the terrain at a distance of 10m contains 12% carbon, 5% iron, 3% silicon, and 80% copper.

You can easily parse this to retrieve the data you are interested in using the key-value system implemented in XenonCode.

Go further

The ore scanner scans the terrain in the direction of its sensor. You can install it on a small pivot to, for example, rotate it and create a composition map around its position using a XenonCode program and the in-game screens.

Energy

The ore scanner consumes low voltage energy to function. Its consumption is directly proportional to the number of channels you use. The more positions you scan in a single tick, the more energy you consume, which is 100 watts per channel per tick.

ComponentNavInstrument
ModuleARCHEAN_celestial
Mass10 kg
Size75 x 75 x 100 cm


Documentation coming soon

ComponentBeacon
ModuleARCHEAN_beacon
Mass2 kg
Size25 x 25 x 75 cm


Description

The beacon is a component that allows for transmitting and/or receiving data to/from other beacons.

Usage

To function, a beacon needs to be powered by low-voltage energy and will consume 10 watts during operation. It can be configured to transmit and/or receive data using the data ports or its configuration interface accessible via the V key.

When placing a beacon, an arrow appears on the hologram to indicate the localize direction of the beacon.

Configuration Interface

  • Transmit Data: Allows sending a number/text data.
  • Transmit Frequency: Allows adjusting transmission frequency.
  • Receive Frequency: Allows adjusting reception frequency.

Informations

  • Last Received Distance: Displays the distance in meters from the last beacon it received data from.
  • Last Received Direction: Displays the direction (x,y,z) from the last beacon it received data from.
  • Last Received Data: Displays the last received data.
  • Is Receiving: Displays if the beacon is currently receiving data.

Data Port

The beacon has a data port that allows it to be used from a computer or other components.

List of outputs

ChannelFunctionRange
0Datanumber or text
1Distancenumber (meters)
2Direction X-1.0 to +1.0
3Direction Y-1.0 to +1.0
4Direction Z-1.0 to +1.0
5Is Receiving0 or 1

List of inputs

ChannelFunctionRange
0Transmit Datanumber or text
1Transmit Frequencynumber or text
2Receive Frequencynumber or text
  • There is no distance limit for communications between beacons, although the closest will have precedence if multiple beacons broadcast on the same frequency.
  • The signal of a beacon is not affected by obstacles.

ComponentSmallThruster
ModuleARCHEAN_thruster
Mass50 kg
Size25 x 50 x 50 cm


Description

The small thruster generates thrust through the combustion of liquid fuel with liquid oxygen. It can handle both CH4 (methane) and H2 (hydrogen) as its fuel. It uses a radial aerospike nozzle and it's very efficient at converting combustion energy directly to thrust. It can produce up to 180 KN of thrust from a flow rate of 10 Kg/s LOX and 1.25 Kg/s H2.

Usage

Connect high flow oxydizer and fuel to the fluid ports, high voltage for ignition, and send 1 in the data port to ignite.

Initial ignition will only occur when the flow rate is between 1 g/s and 5 kg/s, for either the fuel or the oxydizer.

When the fuel is H2, the optimal flow ratio is 8:1 (LOX:H2) and and ratio of < 1:1 may result in a flame out (no combustion). When the fuel is CH4, the optimal flow ratio is 4:1 (LOX:CH4) and and ratio of < 1:1 may result in a flame out (no combustion).

The igniter does not need to be kept on once combustion has begun, although it's a good idea to leave it on in case of a flame out. Ignition consumes 1000 watts continuously when on.

The small thruster's nozzle can gimbal with a variation of -10 to +10 degrees in two axes.

List of inputs

ChannelFunctionRange
0Ignition0 or 1
1Gimbal X-1.0 to +1.0
2Gimbal Z-1.0 to +1.0

List of outputs

ChannelFunctionUnit
0ThrustNewtons
1Burned flowkg/s
2Unburned flowkg/s

If your fuel tank is pre-mixte, you don't need to use both fluid ports.

ComponentBigThruster
ModuleARCHEAN_thruster
Mass400 kg
Size100 x 100 x 100 cm


Description

The big thruster generates thrust through the combustion of liquid fuel with liquid oxygen. It can handle both CH4 (methane) and H2 (hydrogen) as its fuel. It uses a radial aerospike nozzle and it's very efficient at converting combustion energy directly to thrust. It can produce up to 1.8 MN of thrust from a flow rate of 100 Kg/s LOX and 12.5 Kg/s H2.

Usage

Connect high flow oxydizer and fuel to the fluid ports, high voltage for ignition, and send 1 in the data port to ignite.

Initial ignition will only occur when the flow rate is between 1 g/s and 50 kg/s, for either the fuel or the oxydizer.

When the fuel is H2, the optimal flow ratio is 8:1 (LOX:H2) and and ratio of < 1:1 may result in a flame out (no combustion). When the fuel is CH4, the optimal flow ratio is 4:1 (LOX:CH4) and and ratio of < 1:1 may result in a flame out (no combustion).

The igniter does not need to be kept on once combustion has begun, although it's a good idea to leave it on in case of a flame out. Ignition consumes 1000 watts continuously when on.

The big thruster's nozzle can gimbal with a variation of -10 to +10 degrees in two axes.

List of inputs

ChannelFunctionRange
0Ignition0 or 1
1Gimbal X-1.0 to +1.0
2Gimbal Z-1.0 to +1.0

List of outputs

ChannelFunctionUnit
0ThrustNewtons
1Burned flowkg/s
2Unburned flowkg/s

If your fuel tank is pre-mixte, you don't need to use both fluid ports.

ComponentRCS
ModuleARCHEAN_rcs
Mass10 kg
Size25 x 50 x 50 cm


Description

The reaction control system (RCS) consists of cold gas thrusters primarily used to control the orientation and position of a spacecraft. It is also used for fine adjustments during spacecraft docking. The RCS consists of several small thrusters that can be individually and quickly turned on/off to provide precise control.

Usage

The RCS can be powered by various fluids, which will affect its performance depending on their density and pressure. It can be controlled by a computer or another device to adjust the thrust and direction.

It does not perform any kind of combustion.

List of inputs

ChannelFunctionRange
0Nozzle 0 (Center)0.0 to 1.0
1Nozzle 10.0 to 1.0
2Nozzle 20.0 to 1.0
3Nozzle 30.0 to 1.0
4Nozzle 40.0 to 1.0

ComponentWheel
ModuleARCHEAN_wheel
Mass100 kg
Size50 x 75 x 100 cm


Description

The wheel is a component that allows a build to accelerate forward/backward as well as turn and brake. It includes a configurable suspension and gearbox.

Usage

It can be configured through its configuration interface accessible via the V key.

Configuration Interface

It provides information about the wheel and allows for configuration.

Information

  • Motor Rotation Speed: Motor rotation speed in rotations per second.
  • Wheel Rotation Speed: Wheel rotation speed in rotations per second.
  • Power: Power consumption in watts.
  • Brake: Wheel braking value.
  • Ground Speed: Wheel speed relative to the ground in m/s.
  • Gear Ratio: Wheel speed ratio.

Configuration

  • Mudguard: Show/Hide the mudguard.
  • Grip: Adjusts the wheel's grip.
  • Suspension: Adjusts the wheel's suspension.

Energy

The wheel has a low-voltage energy port and a high-voltage energy port.

Low-Voltage Energy

In this configuration, the wheel consumes up to 20 kw.

High-Voltage Energy

In this configuration, the wheel consumes up to 200 kw.

List of inputs

ChannelFunctionRange
0Accelerate-1.0 to +1.0
1Steer-1.0 to +1.0
2Regen0 or 1
3Brake0.0 to 1.0
4Gearbox-1.0 to +1.0

ComponentSmallWheel
ModuleARCHEAN_wheel
Mass20 kg
Size25 x 25 x 25 cm


Description

The small wheel is a simple wheel that can only brake and steer and does not have suspension. It does not require any energy to operate.

Usage

The wheel can be connected to a computer or other device for control.

List of inputs

ChannelFunctionRange
0Brake0.0 to 1.0
1Steer-1.0 to +1.0

ComponentPropeller
ModuleARCHEAN_propeller
Mass100 kg
Size50 x 50 x 50 cm


Description

The propeller is a component that generates thrust using rotating blades. It is used to propel vehicles in the air or in water.

Usage

It can be configured through its configuration interface accessible via the V key.

Configuration Interface

It provides information about the propeller and allows for configuration.

Information

  • Input Voltage: Input voltage in volts.
  • Power: Power consumption in Watts.
  • Thrust: Thrust generated in Newtons.
  • Rotation Speed: Rotation speed in rotations per second.
  • Pitch: Normalized Pitch angle.

Configuration

  • Radius: Propeller radius in meters.
  • Twist: Propeller twist angle (normalized).
  • Blades: Number of blades.

Energy

The propeller has a low-voltage energy port and a high-voltage energy port, which allow for more or less control over the supplied power.

Low-Voltage Energy

In this configuration, the propeller consumes up to 50 kw.

High-Voltage Energy

In this configuration, the propeller consumes up to 500 kw.

List of inputs

ChannelFunctionRange
0Speed-1.0 to +1.0
1Pitch-1.0 to +1.0

ComponentAltitudeSensor
ModuleARCHEAN_sensor
Mass1 kg
Size25 x 25 x 25 cm


Description

The altitude sensor sends the altitude between the sensor's position and the ground or the center of the celestial body through its data port.

Usage

Once placed on your build, it can be connected to a computer, for example, to retrieve the altitude in meters. The orientation of the altitude sensor has no impact on its operation.

List of outputs

ChannelFunction
0Absolute Altitude
1Above Terrain
  • In "Above Terrain" mode, water is not considered as terrain.
  • The altitude sensor only works in the environment of a celestial body.

ComponentSpeedSensor
ModuleARCHEAN_sensor
Mass1 kg
Size25 x 25 x 25 cm


Description

The speed sensor allows you to send the relative speed to the parent object (Planet, mothership...) through its data port.

Usage

Once placed on your build, it can be connected to a computer, for example, to retrieve your speed in meters per second. The orientation of the speed sensor has no impact on its functionality.

ComponentTiltSensor
ModuleARCHEAN_sensor
Mass1 kg
Size25 x 25 x 25 cm


Description

The tilt sensor allows to send through its data port the current tilt based on the horizon.

Usage

Once placed on your build, it can be connected to a computer, for example, to retrieve your tilt between -1.0 and +1.0.
Its long axis is to be used like a level indicator.
-1.0 or +1.0 means titled at 90 degrees with one end pointing perfectly downwards and one pointing perfectly upwards, while 0.0 means level with the horizon.

Does not work in space

ComponentSmallPivot
ModuleARCHEAN_build
Mass10 kg
Size25 x 25 x 50 cm


Description

The Small Pivot is a component that includes a buildable rotating block. It is designed to allow rotation of objects on a build.

Usage

The Small Pivot can operate in two modes: Servo (default) and Velocity. To switch between modes, press the V key to open the component's information interface.

In this interface, there are two additional configurations possible:

  • Max Rotation Speed which determines the maximum rotation speed in rotations per second.
  • Acceleration which determines the rate (in rotations per second per second) at which the pivot will accelerate to reach its Max Rotation Speed.

Servo Mode

In servo mode, the device rotates to a precise position determined by the data received through its data port. It accepts normalized values between -1.0 and +1.0, which correspond to rotations of -360° and +360°. This effectively means that the values 0.0, -1.0 and +1.0 will result in the same servo position.

Velocity Mode

In velocity mode, the device operates continuously in the direction indicated by the data from its port, accepting values between -1.0 to +1.0 to determine it's speed and rotation direction. 1.0 means Max Rotation Speed.

Builds installed on a moving part cannot collide with a parent or sibling build. They can only collide with the terrain or other separate builds.

SmallPivotDemo

ComponentSmallHinge
ModuleARCHEAN_build
Mass10 kg
Size25 x 25 x 50 cm


Description

The Small Hinge is a component that includes a buildable block on a hinge.

Usage

The Small Hinge only operates in servo mode.

When using V to open the information interface, there are two configurations possible:

  • Max Rotation Speed which determines the maximum rotation speed in rotations per second.
  • Acceleration which determines the rate (in rotations per second per second) at which the hinge will accelerate to reach its Max Rotation Speed before slowing down to reach its target position.

The device rotates to a precise position determined by the data received through its data port. It accepts normalized values between -1.0 and +1.0, which correspond to rotations of -90° and +90°, respectively.

Builds installed on a moving part cannot collide with a parent or sibling build. They can only collide with the terrain or other separate builds.

SmallPivotDemo

ComponentDockableDoor
ModuleARCHEAN_build
Mass400 kg
Size250 x 250 x 100 cm


Description

The Dockable Door is a large door that can dock to a similar door to connect two build together. Docking allows for the transfer of data, energy, and fluids between the connected build, but also constrains the two builds together in terms of physics. They are stuck together.

Dockable Doors can only be installed on the face of frames.

Usage

To function properly, the Dockable Door needs to be powered via low voltage. It consumes 20 watts when inactive and up to 250 watts when the doors are in motion.

The interior side of the door has two panels for interacting with the door or transferring data, energy, or fluids through the docking port.

Here is an image illustrating the two panels.

  • The panel in green is for interacting with the door, powering it, and controlling it remotely via a data port. (The table below indicates the inputs/outputs of the data port)
  • The panel in blue is for connecting various cables that will transfer data, energy, or fluids to/from the other docked door.

DockableDoorDemo

List of inputs

ChannelFunction
0Close/Open Door
1Arm/Disarm Dock

List of outputs

ChannelFunction
0Door State
1Dock State

ComponentDockingPort
ModuleARCHEAN_build
Mass50 kg
Size50 x 50 x 50 cm


Description

The docking port is a component that allows two builds to be connected together. The connection enables the transfer of data, energy, and fluids between the connected builds, but it also physically constrains them together. They are stuck together.

Usage

The docking port does not need to be powered. The separate data connector allows controlling the docking port, while the other connectors allow connecting various cables that will transfer data, energy, or fluids to/from the other docking port.

Data Connector

The docking port has a data connector that allows it to be used from a computer, button, or any other component with a data connector.

List of outputs

ChannelFunction
0Is Docked

List of inputs

ChannelFunction
0Arm/Disarm Docking

ComponentSpotLight
ModuleARCHEAN_light
Mass1 kg
Size25 x 25 x 25 cm


Description

The lamp is a component that allows to illuminate a large area with a maximum angle of 120°. It is particularly suitable to place vehicles as headlight.

Usage

The lamp must be powered by low voltage and consumes up to 1000 W depending on the power set in its information menu accessible via the V key.

The colors of the lamp can be changed via the lamp's information menu or via its data port.

List of inputs

ChannelFunctionRange
0Off/On0 or 1
1Red0 to 255
2Green0 to 255
3Blue0 to 255

ComponentLamp
ModuleARCHEAN_light
Mass1 kg
Size25 x 50 x 50 cm


Description

The lamp is a component that allows to illuminate a large area with a maximum angle of 170°. It is particularly suitable to place on ceiling for lighting rooms or work areas.

Usage

The lamp must be powered by low voltage and consumes up to 1000 W depending on the power set in its information menu accessible via the V key.

The colors of the lamp can be changed via the lamp's information menu or via its data port.

List of inputs

ChannelFunctionRange
0Off/On0 or 1
1Red0 to 255
2Green0 to 255
3Blue0 to 255

ComponentSmallGyroscopeGyroscope
ModuleARCHEAN_gyroscopeARCHEAN_gyroscope
Mass50 kg200 kg
Size50 x 50 x 50 cm100 x 100 x 100 cm


Description

The gyroscope is a component that, when powered and active, dampen its angular velocity. It is mainly used to stabilize a vehicle or stop angular momentum in zero G.

Power Supply

The gyroscope must be powered via either low voltage or high voltage. It consumes more power at startup then gradually reduces its consumption as it reaches the rotation speed you have requested via the data port.

Usage

To start the gyroscope, it must receive a value between 0.0 and 1.0 in its data port to decrease/increase its rotation speed, thereby increasing its stabilizing effect.

The gyroscope allows for manually orienting a vehicle through its data port by harnessing the induced torque of the inertial wheels inside it. It will act based on its orientation and rotation speed.

A gyroscope has a limited effect relative to the weight of the build. You can increase the number of gyroscopes to increase the stabilizing effect.

ComponentAileron
ModuleARCHEAN_aileron
Mass10 kg
Size25 x 25 x 100 cm


Description

The aileron is a device that influences the aerodynamics of a build.

Its effectiveness is closely related to the density of the medium in which it operates, whether it is in the atmosphere (aircraft...) or in water (boat...).

Usage

The aileron does not require any energy to operate, only a value between -1.0 and +1.0 through its data port.

ComponentTrashCan
ModuleARCHEAN_storage
Mass10 kg
Size50 x 50 x 100 cm


Description

The TrashCan is a component that allows for instant destruction of the objects of the objets that were put in its inventory.

Usage

F to open the TrashCan inventory. Once opened, you can deposit items to destroy them.

  • The TrashCan can be connected with an item conduit to automatically destroy items coming from an external source.

ComponentGroundAnchor
ModuleARCHEAN_anchor
Mass25 kg
Size25 x 100 x 100 cm


Description

The Ground Anchor is a device that locks a build to the ground when activated, preventing any movement.

Usage

The Ground Anchor operates without requiring external power. Its mechanism relies on a simple value, 0 for deactivated (not anchored) or 1 for activated (anchored) through its data port.

  • When it is anchored, you can destroy the cable connected to the Ground Anchor to reduce the risk of unintentional disengagement.
  • If an OwnerPad is present, using the "Reset" button to move the build will NOT be prevented by the Ground Anchor.
  • The Ground Anchor cannot anchor a vehicle to another vehicle, it only works on terrains.

ComponentOwnerPad
ModuleARCHEAN_owner
Mass1 kg
Size25 x 50 x 50 cm


Description

The OwnerPad is a versatile security device that ensures the protection of builds against potential malicious actions.

In addition to its security function, it allows you to save the state of a build or vehicle (Position, Velocity, Battery Level, switches...).
With this feature, it becomes possible to instantly revert to that state with a single click.

Usage

SAVE & RESET Button

The SAVE button saves the position of a build as well as the state of its components while the RESET button resets the build to the state it was in when last saved.

ROLES Button

Roles allow you to authorize/forbid actions on a build, as shown in the example image. They are designed to ensure the security of your builds against any malicious actions by other players. When you place an OwnerPad on a build, if no other OwnerPad is present, you become the owner of that build.

By default, all permissions are set to @Everyone, making the build completely public.
In addition to @Everyone and dksm (OWNER) in the example, the list of all connected players will be displayed, allowing you to assign roles to the players of your choice.

A Give Ownership button is present next to each connected player to transfer ownership to the player of your choice. You will then have no rights on the build until the new owner grants you roles.

OwnerPadDemo

ComponentContainer
ModuleARCHEAN_storage
Mass100 kg
Size100 x 100 x 200 cm


Description

The container is a storage component with a capacity of 50 slots. It is equipped with two ports for connecting item conduits to receive or send items.

  • The container does not have the ability to directly pull or push items from its ports, it is solely a storage component.

XenonCode - Documentation

XenonCode is a lightweight programming language designed as high level scripting within games for virtual computing devices (ie: a programmable computer within a game).

Capabilities

  • Typed Variables
  • Constants
  • Dynamic Arrays
  • Standard arithmetic operations on numeric values
  • Easy string concatenation and formatting
  • User-defined functions
  • Device-defined functions and objects
  • Trailing/member functions
  • Built-in standard math functions
  • Built-in IO operations between virtual devices
  • Built-in key-value objects
  • Synchronized interval functions (timers)
  • if/elseif/else conditionals
  • while loops
  • foreach loops for arrays
  • repeat n loops (akin to for (i=0;i<n;i++) in most other languages)

Sample code

include "my_functions.xc"

; Declare global storage
storage var $myStorageVar : number
storage array $myStorageArray : number

; Declare global variables
var $myVar = 0
var $myVar2 = "Hello World"
var $myVar3 : number
var $myVar4 : text
array $myArray : number
array $myArray2 : text

; Declare a user-defined function that changes the values of $myVar and $myVar2
function @myFunction($arg1 : number, $arg2 : text)
	$myVar = $arg1
	$myVar2 = $arg2

; Declare a user-defined function that returns a value
function @myFunction2($arg1 : number, $arg2 : text) : number
	return $arg1 + size($arg2)

init
	; Call a user-defined function
	@myFunction(1, "Hello")

	; Call a trailing function
	$myVar.@myFunction2("Hey")

	; Add values to an array
	$myArray.append(1)
	$myArray.append(5)
	$myArray.append(0)

	; Sort an array
	$myArray.sort()

	; Iterate over an array
	foreach $myArray ($item)
		$myVar3 += $item

	; Iterate over an array with index
	foreach $myArray ($item, $index)
		$myVar4 &= $index:text & ": " & $item:text & ", "

	; Output to a virtual device (ie: a console at input port 0)
	output.0 ($myVar4)
	output.0 (text("Sum of values in the array: {}", $myArray.sum))
	output.1 ($myArray.0:text)
	output.1 ($myArray.1:text)
	var $index = 2
	output.1 ($myArray.$index:text)
	
	; Repeat a statement three times
	repeat 3 ($i)
		output.1 ($i)

Types of developer

  1. User: The person who is using this language to write a script, typically a player in a game.
  2. Device: The implementation defining the capabilities and available functions, typically a specific type of programmable virtual device in a specific game.

Syntax

XenonCode is designed with a very basic syntax in mind and a very precise structure.

  • Each statement has to be short and easy to read
  • Very little special characters needed
  • Less criptic than most other languages
  • Indentations define the scope (tabs ONLY, no ambiguity there)
  • A single instruction per line
  • Array indexing, like most other programming languages, is 0-based but uses the arr.0 dot notation instead of the typical arr[0] subscript notation
  • 100% Case-insensitive
  • An implementation may define custom "Device" functions, objects and entry points

Types

XenonCode is a typed language, but only includes two generic types, as well as arrays of either, and implementation-defined objects.

Generic data types the user can declare:

  • number
  • text

A number variable is always a 64-bit floating point internally, but may also act as a boolean when its value is either 1 or 0 (true or false), although any value other than zero is evaluated to true.

text variables contain plain unicode text, altough their maximum size depends on the implementation.
A text literal is defined within double quotes " ".
To use double quotes characters within the text, you may duplicate them.
There is no other escape sequence mechanism. A backslash \ is simply part of the string, and the implementation may decide to use it for escape sequences.

var $myText = "Say ""Hello"" to this text"

Object types are for use by the implementation and are opaque to the user, meaning their structure is not necessarily defined, however the implementation may make availalbe some member functions for those objects to the user.

Even though this is a typed language, specifying the type is not needed when it can be automatically deduced by the compiler during initialization. The type should only be specified when there is no initialization.

All user-defined words must start with a prefix character:

  • $ for variables
  • @ for functions

Comments

Comments are lines that start with either ; or //
A code statement may also end with a trailing comment

Limitations

This language is designed to potentially be executed Server-side in the context of a multiplayer game, hence for security and performance reasons there are limits to what users can do.

  • No pointer nor reference types (except for implementation-defined objects, which must be sanitized by the implementation at runtime)
  • The number of instructions per cycle may be limited, upon which an overflow may cause a virtual crash for the user
  • Arrays may be limited in size at runtime, upon which an overflow may trigger a virtual crash for the user
  • Recursive stack (calling a function recursively) is NOT allowed for the user
  • Functions MUST be fully defined BEFORE their use, so the order of definition matters (this is what enforces the previous point)

Per-Virtual-Computer limitations

These are defined per implementation and may include multiple variants or be customizable by the user

  • ROM (max compiled program size as a number of 32-bit words)
  • RAM (max number of local, global and tmp variables plus all local and global arrays multiplied by their size)
  • STORAGE (max number of storage variables plus all storage arrays multiplied by their size)
  • Frequency (max frequency for timer functions and input read)
  • Ports (max number of inputs/outputs)
  • IPC (max instructions per cycle, one line of code may count as multiple instructions)

Operation on data

  • All functions, including timers, are executed atomically, preventing any data-race
  • Function arguments are always passed by copy, a function CANNOT modify the variables placed in its argument list
  • Trailing functions DO modify the value of the leading variable
  • Variable assignments always copy the value for generic types
  • Implementation-defined objects are always passed by reference
  • Implementation-defined objects cannot be copied unless the implementation provides that functionality through a device function
  • Divisions by zero results in the value zero. It is at the responsibility of the user to make sure to account for it.

Basic rules

  • Variables may be declared using var and optionally assigned an initial value otherwise the generic default is used (0 for number and "" for text)
  • Object variables must be assigned upon declaration using a constructor or a device function that returns an object of that type
  • Starting a statement with a varialbe name (starting with $) means that we are modifying its value
  • If the next word following a variable assignment is =, then the following expression's result is going to be assigned as its value
  • If the next word following a variable assignment is a dot and a function, this function call is considered a trailing function
  • Calling a trailing function DOES modify the value of the leading variable wich is also used as the function's first argument which must be omitted from the argument list when calling it
  • Starting a statement with a function name (starting with @ for user-defined functions) means that we are calling this function and discarding its return value
  • Calling a function will NEVER modify the value of any of its generic-typed arguments passed within parenthesis, generic types are always passed by copy
  • Anything in parenthesis that is not preceeded by a function name is considered a separate expression, inner left-most expressions are computed first
  • Typical rules apply for mathematical precedence of operators

Valid usage

XenonCode is designed to be compiled as byteCode which is very fast to parse by the host game at runtime.

Each line must begin with one of the following first words (with examples):

Global scope

  • include Imports the content of another file
  • const declare a global constant
  • var declare a global variable
  • array declare a global array
  • storage declare a storage variable or array, which will be persistent across power cycles
  • init Define the body of the init function, which will execute once when the device is powered on
  • tick declare the body of the tick function that will execute at each clock cycle
  • function declare a user-defined function
  • timer Define the body of a function that will execute repeatedly at a specific frequency in Hz
  • input Define an input function
  • ; or // Comments
  • an entry point defined by the implementation
  • one or more tabs, meaning we're within a function body, then the following rules apply:

Function body / Entry point

  • var Declare a new variable in this local scope (not accessible from outside of this function)
  • array Declare a new array in this local scope (not accessible from outside of this function)
  • $ To assign a new value to an existing variable
  • @ To call a user-defined function
  • output Built-in function to send data to another device through a specific port
  • foreach loops through all items of an array
  • repeat loops a block of code n times
  • while loops as long as a condition evaluates to true
  • break stops a loop here as if it completed all iterations
  • continue stops this iteration of a loop here and run the next iteration immediately
  • if runs a block of code if a condition evaluates to true
  • elseif after a if, when the initial condition so far evaluates to false and a new condition evaluates to true
  • else after a if, when all conditions evaluated to false
  • return stop the execution of this function here and return a value to the caller

Reserved keywords

Since all user-defined words must start with either $ or @, there is no need for reserved words.
The implementation/device must take care of only defining function names and object types that do not conflict with built-in keywords for the version of XenonCode that they're using.

Declaring a constant

Constants are named values that should never change throughout the execution of a program. They are fixed values defined at compile-time.
Their assigned values must be explicitely given and must be expressions which the result can be determined at compile-time.

const $stuff = 5 declares a constant named $stuff with the number 5 as its value const $stuff = "hello" declares a constant named $stuff with the text "hello" as its value

Declaring a variable

Variables are named values that can change throughout the execution of a program.
We may or may not assign them an initial value.
If we do not assign an initial value, the default generic value is used, and we must provide a type.
A variable is only accessible within the scope it has been declared in. For instance, if we declare a variable at the biginning of a function, it is available throughout the entire function. If we declare a variable within a if block, it is only available within that block, until the corresponding else, elseif or until going back to the parent scope.
A variable declared in the global scope is accessible from everywhere.
For variables declared in the global scope, when we assign it an initial value, the given expression must be determined at compile-time.
Variable names must start with a letter or underscore (a-z or _) then must contain only alphanumeric characters and underscores.

var $stuff = 5 declares a number variable with an initial value set to 5 when the program starts
var $stuff = "hello" declares a text variable with an initial value set to "hello" when the program starts
var $stuff:number declares a number variable with an initial value set to 0 when the program starts
var $stuff:text declares a text variable with an initial value set to "" when the program starts
var $stuff = position() declares an instance of an implementation-defined object of the type position (this is an example)

Implementation-defined objects cannot be declared without initialization, since they do not have a default value.

Assigning a new value to a variable

To assign a new value to a variable, we can simply start a statement with the variable name followed by a = and an expression the result of which will be the new value.
We may also use a trailing function which will inherently modify the value of said variable.

$stuff = 5 assign the value 5 to the variable named $stuff
$stuff = $other + 5 assign the result of the expression ($other + 5) to the variable named $stuff
$stuff.round() call a trailing function that rounds the value of the variable

Declaring an array

An array is a dynamic list of values of a certain type. We can append or erase values, we can access a specific value from the list, or loop through all its values.
When declaring an array, we cannot specify an initial value, and we must provide a type.
Arrays are initialized with zero size when the program starts, values may be added/erased/modified throughout the execution of the program

array $stuff:number declare an array of numbers
array $stuff:text declare an array of texts

Arrays cannot contain implementation-defined objects, just generic types.

Declaring storage

Storage is used to keep some data persistent across power cycles and even through a re-compile.
We can declare storage variables and arrays of either number or text.
Storage should ONLY be declared in the global scope.

storage var $stuff:number
storage var $stuff:text
storage array $stuff:number
storage array $stuff:text

Accessing/Assigning the nth item within an array

To access or modify the value of a specific item in an array, we must use the trail operator . followed by the 0-based index of the item or a variable containing that index
$stuff.0 = 5 Assign the value 5 to the first item of the array
$stuff.$index = 5 Assign the value 5 to the item with an index defined by the value of $index
$value = $stuff.1 Assign the value of the second item of the array to the variable $value

Accessing/Assigning the nth character within a text variable

Text variables work in a very similar way to arrays. We can use the trail operator . to access or modify the value of specific charaters within a text.
$myText.0 = "a" Set "a" as the first character of $myText

Key-Value objects

XenonCode supports its own key-value type that is always stored as text.
Simply declare a text variable and assign/read its members using its key as the trailing member

var $myObject = ".a{5}.b{8}" ; you can use the serialization format like so, but you don't have to, you may simply start with an empty text and assign the members one by one
print($myObject.a) ; will print 5
$myObject.b += 2 ; adds 2 to b which was 8 and will now be 10

The Init function

The Init function's body will be executed first everytime the virtual computer is powered on.
The init function cannot be called by the user. It can only be defined, and the device will automatically call it upon virtual startup.

init
    $stuff = 5
    @func1()
    ;...

Tick function

The tick function is executed at the beginning of every clock cycle of this virtual computer.
The tick function cannot be called by the user. It can only be defined, and the device will automatically call it for each cycle.

tick
    ; This body is executed once per clock cycle at the virtual computer's frequency

Timer functions

Timer functions are executed at a specified interval or frequency, but at most once per clock cycle.
We can either specify an interval as in every N seconds or a frequency as in N times per second.
Timer functions cannot be called by the user. They can only be defined, and the device will automatically call them at their appropriate time.

timer frequency 4
    ; stuff here runs 4 times per second
timer interval 2
    ; stuff here runs once every 2 seconds

Note: If the clock speed of the virtual computer is slower than the given interval or frequency, that timer function will not correctly run at the specified interval or frequency, and may be executed at every clock cycle instead.

Input functions

Input functions are a way of accessing the information that we have received from another device.
They may be executed any number of times per clock cycle, depending on how much data it has received since the previous clock cycle. The implementation may decide to only run it once per cycle using only the latest data received.
Devices may have an upper limit in the receiving buffer which defines the maximum number of times the input function may be called per clock cycle.
If that limit has been reached, only the last N values will be kept in the buffer.
Input functions are like user-defined functions, containing arguments, but no return value, and also we must specify a port index.
The port index must be specified after the input keyword and a trail operator .
The port index may be specified via a constant as well (must be known at compile time).
Function arguments must be surrounded with parenthesis and their types must be specified.
Input functions cannot be called directly by the user. They can only be defined, then the device will automatically call them if data has been received, at the end of a clock cycle.

input.0 ($arg1:number, $arg2:text)
    $stuff = $arg1
input.$myPortIndex ($arg1:number, $arg2:text)
    $stuff = $arg1

Output

The output function is how we send data to another device. This function is meant to be called as a statement, and cannot be used in the global scope like the input functions are.
We must also pass in the port index as we do with the input function, and it can also be specified via a constant that is known at compile-time.
We must pass a list of arguments surrounded with parenthesis (or an empty set of parenthesis).
output.0 ($stuff, $moreStuff)

If Elseif Else

Like most programming languages, we can use conditionals.

if $stuff == 5
    ; then run this
elseif $stuff == 6
    ; then run that instead
else
    ; all previous conditions evaluate to false, then run this instead

Foreach loops

This loops through all items of an array.
The block of code under that loop statement will be executed for every item in the array, one by one.

foreach $stuff ($index, $item)
    ; we loop through the array $stuff, and we define $index which contains the 0-based index of this item and $item for the current item's value
    ; note that $item is a copy of its value, so modifying the value of $item will not affect the original array $stuff
    ; if we want to persist the modified $item value into the original array, we can use $index to index the element from the array like so:
    $stuff.$index = $item
    ; CAUTION: $index is a reference used internally for the loop, don't modify its value unless you actually want to affect the loop

You may also use the foreach loop with key-value objects

foreach $obj ($key, $value)
    print($key)
    print($value)

Repeat loops

This loop will repeat the execution of the following block a given number of times.

repeat 5 ($i)
    ; this block will be repeated 5 times, and $i is the 0-based index of this iteration (first time will be 0, last will be 4)
    ; CAUTION: $i is a reference used internally for the loop, don't modify its value unless you actually want to affect the loop

The number of times (above specified as 5) may also be specified via a variable or a constant, but not an expression

While loops

This loop will run the following block as long as the given condition evaluates to true.

while $stuff < 5
    $stuff++

Break

This keyword is used to stop a loop as if it completed all its iterations.

while $stuff < 5
    $stuff++
    if $stuff == 3
        break

Continue

This keyword is used to stop this iteration of a loop here and run the next iteration immediately.

while $stuff < 5
    $stuff++
    if $stuff == 2
        continue

Math Operators

  • + addition
  • - subtraction
  • * multiplication
  • / division
  • % modulus
  • ^ power

Trailing Operators

  • ++ increment the variable's value
  • -- decrement the variable's value
  • !! reverses the variable's value (if it's value is 0, sets it to 1, otherwise to 0)

Assignment operators

  • = just assign the following value directly

The following operators will compute the appropriate math operation between the leading variable and the following expression, then assign the result back to the leading variable.

  • += addition
  • -= substraction
  • *= multiplication
  • /= division
  • %= modulus
  • ^= to the power
  • &= concatenate text

Conditional Operators

  • == equal to
  • <> or != not equal to
  • > greater than
  • < lesser than
  • <= lesser or equal to
  • >= greater or equal to
  • && or and conditional AND
  • || or or conditional OR
  • xor is also available, equivalent to (!!a != !!b)

Other operators

  • . (trail operator) refer to a sub-item of an array or text or call a trailing function on the leading variable, or a member of an object
  • : (typecast operator) cast as another type
  • & (concat operator) concatenate texts
  • ! (not operator) reverses a boolean value or expression (non-zero numbers become 0, and 0 becomes 1)

Casting (parse variables as another type)

To parse an existing variable as another type, simply add a colon and the type, like so:

$someTextValue = $someNumberValue:text

This only works with generic types number and text, not arrays or objects.

String concatenation

To concatenate texts, simply separate all text values/variables with the concat operator & in the same assignment (don't forget to cast to text if you need to).

$someTextVar = "Hello, " & $someName & "!, My age is " & $age:text & " and I have all my teeth"

Include

You may want to split your project into multiple source files.
To do this, you can put some code into another .xc file and use the include keyword in the parent file.

include "test.xc"

This is effectively the same as taking all the lines from test.xc and inserting them into the current file where the include is.
This can be done on multiple levels, just make sure that a file does not include itself, directly or indirectly, in which case the definitions within it will conflict and result in a compile error.

User-Defined Functions

Functions define a group of operations that we may call one or more times during the execution of the program.

The operations to run in a function appear within its body.

Functions may have arguments that can be used within the body so that the operations may have a variation depending on the value of some variables.

Function arguments are defined after the function name, within parenthesis and they can be of type number, text, or implementation-defined object.

Function names have the same rules as variable names.

NOTE: Functions MUST be fully defined before their use. This means that the order of function declaration matters and we can only call a function that has been declared ABOVE the caller and a function CANNOT call itself. This enforces the "no-stack-recursion" rule.

Declaration

Here are some function declaration examples

This function takes in a single number argument:

function @func0 ($var1:number)

This function takes two number arguments:

function @func1 ($var1:number, $var2:number)

This function takes a number argument and a text argument:

function @func2 ($var1:number, $var2:text)

This function takes an implementation-defined object type position argument:

function @func3 ($var1:position)

This function takes a number argument and a text argument and returns a number value:

function @func2 ($var1:number, $var2:text) : number

Body

The body of a function (the operations to be executed when calling it) must be on the following lines after the declaration, indented with one tab.
Empty lines within a body are allowed and ignored by the compiler.
Functions bodies may have a return statement optionally followed by an expression that would be used to assign a leading variable in the caller statement.
When returning a value, the return type must be provided at the end of the arguments, after the closing parenthesis and a colon.

function @func1 ($var1:number, $var2:number) : number
    return $var1 + $var2

Call

Calling a function will run the operation in its body. To call a function, simply write the name of the function (starting with @ for user-defined functions), then its arguments within parenthesis separated by commas, like so:

@func1(4, 6)

Here we have passed two number arguments, thus this call executes the body of the declaration above.
It is of course also possible to use variables or even complex expressions instead of just literal numbers as the function arguments.

NOTE:

Omitted arguments are legal.
Their value initially takes the default empty ("" or 0) then persists with what is passed in or assigned to them for the following calls to that function.
Changing the value of an argument within that function will also be persistent for the next call to that function, if that argument is omitted. Hence, if a concept of a default argument value is needed, they can be assigned to the argument in the body of that function after their use.
This omitted argument concept can also be thought of as a concept similar to static local variables in C++.

Return value

Functions may return a value using the return keyword.
This returned value may be assigned to a variable like so :

$value = @func1(4, 6)

Trailing functions

Any function may be called as a trailing function, even user-defined functions.
The way they work is that under the hood the leading variable is passed as the first argument to that function, and then assigned the returning value.
When calling a trailing function, we must ommit the first argument as it automatically sends the leading variable as its first argument under the hood.
If the function definition does not have any arguments, this is still valid, although we simply don't care about the current value of the leading variable, but we'll assign a new value to it.
The function definition MUST have a return type that matches that of the leading variable, if it's a generic type.
A trailing function may be called on implementation-defined objects, in which case the first argument must be of that object type, there is no return type in the function and it must NOT return any value.
Since we cannot pass Arrays as function arguments, arrays can only take their own specifically defined trailing functions.

$myVariable.round()
$myVariable.@func1(6)
$myArray.clear()

Built-in functions

Math

These functions are defined in the base language and they take one or more arguments.
Trailing math functions will use the leading variable as its first argument and modify that variable by assigning it the return value.

  • floor(number)
  • ceil(number)
  • round(number)
  • sin(number)
  • cos(number)
  • tan(number)
  • asin(number)
  • acos(number)
  • atan(number) or (number, number)
  • abs(number)
  • fract(number)
  • log(number, base)
  • sqrt(number)
  • sign(number)
  • pow(number, exponent)
  • clamp(number, minimum, maximum)
  • step(edge1, edge2, number) or (edge, number)
  • smoothstep(edge1, edge2, number)
  • lerp(a, b, number)
  • mod(number, divisor) the modulus operator
  • min(number, number)
  • max(number, number)
  • avg(number, number)
  • add(number, number)
  • sub(number, number)
  • mul(number, number)
  • div(number, number)

Text functions

  • substring(inputText, start, length) returns a new string
  • text(inputTextWithFormatting, vars ...)
  • size(inputText) returns the number of characters in $myText
  • last(inputText) returns the last character in $myText

Formatting

The text function takes a format as the first argument.
The format is basically a text that may contain enclosing braces that will be replaced by the value of some variables or expressions.
Exemple:

$formattedText = text("My name is {} and I am {} years old.", $name, $age)

Empty braces above will be replaced by the corresponding variables in the following arguments in the same order.
It is also possible to format number variables in a specific way by providing some pseudo-values within the braces like so:

  • {} automatically display only the necessary digits based on the value (ex: 3 or 123.456)
  • {0} round to nearest integer value (ex: 3 or 123)
  • {00} round to nearest integer value but also display at least two digits (ex: 03 or 123)
  • {0e} display the rounded integral value as a scientific notation (ex: 3e+00 or 1e+02)
  • {0e.00} display the value as a scientific notation with two digits after the decimal (ex: 3.00e+00 or 1.23e+02)
  • {0.0} round to one digit after the decimal (ex: 3.0 or 123.5)
  • {0000.00} display at least 4 integral digits and round to two digit after the decimal (ex: 0003.00 or 0123.46)

Trailing functions for Arrays

These functions MUST be called as trailing functions, and they do not return anything, instead they modify the array

  • $myArray.clear() Empty an array
  • $myArray.sort() Sort an array in Ascending order
  • $myArray.sortd() Sort an array in Descending order
  • $myArray.append(value) Append a new value to an array
  • $myArray.pop() Erase the last value in an array, reducing its size by one
  • $myArray.insert(index, value) Insert a new value to an array after a position, pushing back all following values by one
  • $myArray.erase(index) Erase an element from an array at a specific index, pulling back all following values by one
  • $myArray.fill(qty, value) Resize and Fill an array with a given size and the specified value for all items (this clears any values previously present in the array)
  • $myArray.from(other [, separator]) Set the contents of the array to another array or text. Separator is for splitting with a specific string (only valid when other is a text). This function also works in reverse when executed on a text given an array and a separator.

Trailing members for Arrays

Using the trail operator ., we can also return a specific information about certain types of variables.

  • $myArray.size returns the number of elements in $myArray
  • $myArray.min returns the minimum value within a number array
  • $myArray.max returns the maximum value within a number array
  • $myArray.avg returns the average value within a number array
  • $myArray.med returns the median value within a number array
  • $myArray.sum returns the sum of all values within a number array
  • $myArray.last returns the value of the last item within an array, this also allows to modify that value by assigning an expression

Other useful helpers

  • contains($myText, "str") returns 1 if $myText contains "str", otherwise 0
  • find($myText, "str") returns the index of the first character of the first occurance of "str" in $myText, otherwise -1 if not found These also work on arrays.

Device functions

An implementation should define application-specific device functions.
Here are examples of basic device functions that MAY or MAY NOT be defined:

  • delta() returns the time difference in seconds from the last execution of this delta function
    Device functions that do not require any arguments may be used without parenthesis when called from within an expression.

Compiler Specifications

This section is intented for game developers who want to use this in their game.

XenonCode comes with its own parser/compiler/interpreter library, and a very simple cli tool.

Editor

It is encouraged that the code editor runs the following parse on the current line on each keystroke:

  • Replace leading sequences of spaces with exactly one tab more than the previous non-empty line, if it starts further than it
  • Autocomplete words upon pressing the space bar if that word is not an existing symbol
    • Write the minimum remaining characters (common denominator) of the symbols that start with the written characters
      • If this is the leading word: Only autocomplete with global scope statement words
      • If preceded with tabs: Only autocomplete with function body statement words
      • When the first character in the current word is a $, autocomplete with a user variable
      • When the first character in the current word is a @, autocomplete with a user function
      • Otherwise, Autocomplete with one of:
        • Current function/foreach/repeat arguments
        • Built-in functions
        • Operators

Runtime

Upon powering up the virtual computer:

  • Execute the body of the init() function

One clock cycle, executed 'frequency' times per second:

  • Execute all input functions that have received some data since the last cycle (once each per cycle)
  • Execute custom events / entry points
  • Execute the tick function
  • Execute all timer functions sequentially if their time is due
  • Sleep for Elapsed-1/Frequency Seconds

Testing XenonCode

You may want to test XenonCode or practice your coding skills.
There is an online fiddle tool at XenonCode.com

Otherwise, you may want to try running it directly on your computer.
For this, XenonCode has a cli with a -run command to test some scripts in the console.
This repository comes with the cli tool, located in build/xenoncode
Here's how you can download and run XenonCode:

# Clone this github repository
git clone https://github.com/batcholi/XenonCode.git
cd XenonCode
# Compile & Run the XC program located in test/
build/xenoncode -compile test -run test

You may edit the .xc source files in test/ then try running the last line again to compile & run.
test/storage/ directory will be created, it will contain the storage data (variables prefixed with the storage keyword).
Note that this -run command is meant to quickly test the language and will only run the init function.
Also, make sure that your editor is configured to use tabs and not spaces, for correct parsing of indentation.

If you want to integrate XenonCode into your C++ project, you can include XenonCode.hpp.
Further documentation will be coming soon for this, in the meantime you may use main.cpp as an example but its usage is still subject to change.

Archean XenonCode Documentation

This is the extended documentation related to the Archean specific implementation of XenonCode. For the basic syntax of XenonCode, please refer to Documentation.


Includes

Includes are useful to either share functionality between programs, merge multiple programs into one, or just to keep your programs clean and organized.

include "some_helper_functions.xc"

Basic Declarations

var $num_value : number
const $speed_of_light = 299792458

Storage Declarations

storage var $memorized_value : number
storage array $memorized_names : text

Storage values are retained between reboots and program modifications. They are always default-initialized to 0 or empty.

Program Entry Points

init
; This entry point is executed once when the program is loaded.
; Only one 'init' entry point may be defined in a program.

shutdown
; This entry point is executed once when the computer is powered off or before it is rebooted (but NOT when it crashes).
; Multiple 'shutdown' entry points may be defined in a single program and they will all be executed in the order they are defined.

input.0 ($value0:number, $value1:number, $value2:text)
; This entry point is executed whenever a value is received from the input with the specified IO index.
; The arguments are the values received for each channel. Any number of arguments can be provided, with their appropriate types.
; There can only be one 'input' entry point defined per IO index per program.

click ($x:number, $y:number)
; This entry point is executed whenever a user clicks on the screen, given an xy coordinate in pixels.
; Multiple 'click' entry points may be defined in a single program and they will all be executed in the order they are defined.

tick
; This entry point is executed once every server tick.
; Only one 'tick' entry point may be defined in a program.

timer interval 5
; This entry point is executed every 5 seconds.
; Multiple 'timer interval' entry points may be defined in a single program and they will all be executed as their time has come, after the tick.
timer frequency 10
; This entry point is executed 10 times per second.
; Multiple 'timer frequency' entry points may be defined in a single program and they will all be executed as their time has come, after the tick.

update
; This entry point is executed on each server tick at the end of each cycle, after the timers.
; Multiple 'update' entry points may be defined in a single program and they will all be executed in the order they are defined.

Built-in values

$num_value = time ; the current time as decimal unix timestamp in seconds with microsecond precision
$num_value = delta_time ; the time interval between ticks in seconds (equivalent to 1.0 / system_frequency)
$num_value = tick ; the index of the current tick since the computer has started

$num_value = char_w ; the width of a character in pixels, taking into consideration the current text size
$num_value = char_h ; the height of a character in pixels, taking into consideration the current text size

$num_value = screen_w ; the width of the virtual monitor in pixels
$num_value = screen_h ; the height of the virtual monitor in pixels

$num_value = clicked ; whether the mouse button was pressed while aiming at the virtual monitor
$num_value = click_x ; the x coordinate of the mouse cursor on the virtual monitor when the mouse button was pressed
$num_value = click_y ; the y coordinate of the mouse cursor on the virtual monitor when the mouse button was pressed

$num_value = system_frequency ; the frequency of the system clock in hertz (ticks per second)
$num_value = programs_count ; the number of programs currently on the virtual HDD

$num_value = pi ; 3.14159265.....
$num_value = 2pi ; 3.14159265 * 2

Built-in functions

var $programName = program_name(0) ; returns a program name, given an index between 0 and programs_count-1
load_program($programName) ; loads a program and call its init function (it first unloads the currently running program, calling shutdown on it)
reboot() ; reboots the computer (calls the shutdown entry point and loads the bios or main program)

; Random Generator
$num_value = random(0, 100) ; returns a random integer value between 0 and 100 inclusively
$num_value = random ; returns a random float value between 0.0 and 1.0 (hitting exactly 0.0 or 1.0 is statistically improbable)

IO

; input_[number|text](aliasOrIoNumber, channelIndex) ; returns the value of the input with the given alias and index
var $someNumber = input_number("", 0)
var $someText = input_text("", 0)

; output_[number|text](aliasOrIoNumber, channelIndex, value) ; sends the given value to the output with the given alias and index
output_number(0, 0, $num_value) ; send a number to output with alias computer
output_number("computer", 0, $num_value) ; send a number to output with alias computer
output_text("computer", 0, "hello") ; send text hello to output with alias computer

Color

var $blue = color(0, 0, 255) ; returns an RGB color given three values between 0 and 255. This will always assume full opacity (as if 255 is passed in the a component).
var $translucentRed = color(255, 0, 0, 128) ; returns an RGBA color given four values between 0 and 255. A value of 128 in the a component will effectively be 50% opacity. 0 would mean transparent.
var $redComponent = color_r($translucentRed) ; is effectively the reverse of the previous function to get back the 255 value. Same can be done with color_g, color_b and color_a.

; Built-in colors
var $black = black
var $white = white
var $red = red
var $green = green
var $blue = blue
var $yellow = yellow
var $pink = pink
var $orange = orange
var $cyan = cyan
var $gray = gray
var $purple = purple
var $brown = brown

Screen Rendering functions (draw on a virtual screen)

blank($black) ; clears the screen with a given color

write(0, 0, green, "Hello") ; write a green Hello message in the top left corner of the screen
write(0, char_h, blue, "Hey") ; write a blue Hey message just under the first message
; Note that char_w and char_h return the size of one character in pixels + 1 additional pixel, to serve as a multiplier to jump lines or to count the width of a text.

text_size(2) ; sets text size to two times native, only valid for following writes in the current cycle until the next call to text_size()

; Draw functions take positions X and Y where 0,0 = top-left, in pixels.
; draw_point(x, y, color)
draw_point(screen_w/2, screen_h/2, white) ; draw a single white pixel in the middle of the screen
; draw_line(x1, y1, x2, y2, color)
draw_line(0, 0, screen_w, screen_h, yellow) ; draw a yellow line going from top left to bottom right of the screen
; draw_rect(x1, y1, x2, y2, color [, fillcolor])
draw_rect(50, 50, 60, 60, red) ; draw a red square starting at coordinates 50,50 inclusive through 60,60 exclusive, it will effectively have a size of 10x10.
; draw_triangle(x1, y1, x2, y2, x3, y3, color [, fillcolor])
draw_triangle(screen_w/2, 0, 0, screen_h, screen_w, screen_h, blue) ; draw a blue triangle from the top middle to the bottom corners of the screen
; draw_circle(x, y, radius, color [, fillcolor])
draw_circle(screen_w/2, screen_h/2, 50, green) ; draw a green circle with a radius of 50 pixels in the middle of the screen

; Draw functions may also be turned into Buttons. Works with rect, triangle and circle.
if button_rect(0, 0, 40, 10, gray) ; draw a gray rectangle button in the top left corner of the screen. Evaluates to true if clicked.
	if user == owner
		print("The owner of this computer clicked the button")
	else
		print("The button was clicked by " & user) ; prints a message to the console (when the button was clicked, in this case)
; Here we also happen to use the built-ins 'user' and 'owner' which are player usernames

var $somePixelColor = pixel(10, 10) ; get the current color of the pixel at coordinates 10,10

; For rendering to external screens, you may define a screen object and call any of the above Screen Rendering functions.
; The screen() constructor takes in two arguments 0 or two arguments. If no arguments are provided, it will refer to the computer's screen, if available.
; The arguments are ioNumber and channelIndex.
var $dash = screen(0,1) ; declare a screen plugged into port 0 using the channel 1
$dash.draw_circle($dash.width/2, $dash.height/2, 50, green) ; draw a green circle with a radius of 50 pixels in the middle of the external screen
; Note that screen_w and screen_h are now width and height respectively. Everything else is the same.

XenonCode IDE

The XenonCode IDE is an interface that allows you to create/edit scripts and programs to control components and systems. It is based on the XenonCode programming language, which has been written especially for this game.

Features

  • Text Editor: A text editor with syntax highlighting for writing scripts/programs.
  • Node Editor: An alternative programming system based on visual nodes for creating scripts in a visual and intuitive way.
  • Console: A console for displaying information, debugging and error messages.
  • Toolbar: A toolbar for creating/deleting scripts/programs, restarting the system, and accessing the documentation available on the Archean page.

Using the IDE on computers

The CODE button on computers allows access to the IDE. From there, you can start writing scripts and programs to control components and systems.

Additional information specific to computers

Computer

The computer has an integrated touch screen and a UI BIOS that displays system information and available programs on the hard drive at startup. You can select a program to execute by aiming at it and pressing the F key.

Mini Computer

The MiniComputer is smaller than the Computer and does not have a touch screen or a visual BIOS. It will natively execute the first program created on the hard drive.

Interface

The XenonCode IDE's interface works a lot like a normal IDE that programmers use, except that instead of having a file hierarchy, all the files in that virtual computer's HDD will always be opened as Tabs.
Tabs can be moved around and docker in and out of the IDE, put side-to-side, top-down, etc.
You may have multiple IDEs (meaning from multiple in-game computers) open at the same time in the game, althought they cannot be docker/snapped together.

Creating a custom BIOS

It is possible to customize the computer's BIOS by creating a file named main.xc. This file is the first to be executed when a computer starts up. You can use it to modify the appearance of the BIOS or to automatically load a program or directly execute any type of code.

Programs vs Files

A Program is a file that can be loaded using load_program(), and its name will end in *.main.xc (you don't have to add that in the name, just write the prefix).
A File is to be included within a program, cannot be loaded as a standalone program, but can be a custom bios when named exactly main.xc without any prefix.
Programs can be written with either the Node system or pure Code, whereas normal files can only be written in pure Code.
Programs may include() files or other programs, as long as there's no naming conflict in their contents, and only one init entry point is defined.

Switching between modes (visual nodes / code)

When you create a program, it will start with the Visual Nodes mode and a few initial IO nodes as an example which you may delete.
The Visual Nodes system will always automatically generate code in the background as you make modifications.
You may "Switch To Code" at any time, however it won't be editable right away.
To make it editable, you can "Convert to Code", which will simply comment out the first #NODES line that defines the nodes, and you will be able to edit the code.
After editing in code, if you want to switch back to nodes, your code will be overridden by the nodes that you had before you initially switched to code.
This means that typically, when converting to code, it's permanent, unless you want to revert it back to how it was.

Running the code

The in-game computers will always auto-reboot whenever a change has been saved in the current file (CTRL+S).
Saving without making any change won't do anything, but you can force it to reboot using CTRL+SHIFT+S, which will also force-save ALL open files.
Upon rebooting after saving a change, the computer will immediately load the previous program if there was one runnin, without going through the BIOS.
If an error occured, either from a syntax error or a runtime error (like a division by zero or bad indexing), the computer will freeze and blank the screen, and the error will appear in the console. At this point, you will need to fix the issue and reboot it by saving the changed file.

Persistency

In-game computers all run on the server-side, and they will keep running when you log out, if you're playing on a dedicated server.
Files are saved on the server's HDD in plain text, including a temporary file for unsaved changes, which is updated at every single change, so you won't lose your code.
Even if you had not saved your file, if your game crashes, whether you're playing solo or remotely, you will recover it when you log back in.
If you prefer using an IDE external to the game, like vscode, you can also edit the files directly on the server, if you're hosting it yourself or playing solo.
The virtual HDDs are stored in Archean-data/server/worlds/<WORLD_NAME>/ARCHEAN_computer/HDD-* and they contain the .xc files as you've created them, as well as the storage subdirectory which will contain storage variables in their own individual files with their values in plain text, newline-separated for arrays.
When editing a file externally, the game will detect any changes made to the currently running program and will automatically reboot the computer.
Editing a storage file however, won't cause a reboot, and the values won't be used immediately, as they are cached in the computer's memory upon load.
The storage files will be updated immediately on the server's hdd upon modifying the value though.

Collaboration

The IDE is collaborative, meaning multiple players are able to at least view the contents, while a single player at a time can edit the code.
Whenever the editor player makes a change, even if not saved, other players will see the change happen in realtime, whether it's in Code or Nodes mode.
Non-editor players are read-only, they cannot edit the code or nodes, until they click on Edit, in which case they will become the current editor and the previous editor will become a read-only viewer.

Shortcut keys

  • CTRL+S Save the current file and reboot the computer
  • CTRL+SHIFT+S Save all files and reboot the computer
  • CTRL+D Select the next occurance in the code, or Dupplicate the selected node(s) when using Nodes mode
  • CTRL+C Copy selected code or nodes
  • CTRL+V Paste code or nodes
  • CTRL+N Create a new File
  • CTRL+SHIFT+N Create a new Program
  • CTRL+Q Close the IDE

VSCode

We have made available a vscode extension to support XenonCode syntax highlighting as well as some linting, if you wish to use it.


Visual Nodes Editor

The XenonCode IDE's node editor offers a wide range of nodes to help you create scripts and programs.

It is comprehensive enough to handle complex tasks and is also easier to grasp for beginners. For even more advanced possibilities, you can also use XenonCode in text mode (code).


Code generation

The Visual Nodes system will always automatically generate code in the background as you make modifications.
The code is generated whenever an output, print, or execute endpoint node is added, and it will back-propagate through input dependencies.
This means adding an input node won't generated any code, but adding an output node will generate the code for both nodes when you connect them together.


List of nodes

Here is a list of the different types of nodes available in the editor, along with their descriptions if necessary:

Constant Number Defines a constant numerical value.

Constant Text Defines a constant textual value.

Variable Number Defines a variable numerical value that can be defined and reset by another node.

Variable Text Defines a variable textual value that can be defined and reset by another node.

Comment Allows you to display a comment block in your script.


Input

By Alias Use an output node of a component using its alias.

0,1,2,3... Use an output node of a component that is currently connected to a port on the computer. When you connect a component to a port, it is automatically detected by the computer.


Output

Print (Console log) Displays a number/text in the computer console.

By Alias Use an input node of a component using its alias.

0,1,2,3... Use an input node of a component that is currently connected to a port on the computer. When you connect a component to a port, it is automatically detected by the computer.


Math

Add Returns the addition of two values.

Subtract Returns the subtraction of two values.

Multiply Returns the multiple of two values.

Divide Returns the division of two values.

Absolute Returns the absolute value of a number.

Negative Returns the negative value of a number.

Modulo Returns the remainder of the division of two numbers.

Floor Returns the value rounded down to the nearest integer.

Ceil Returns the value rounded up to the nearest integer.

Round Returns the value rounded to the nearest integer.

Fract Returns the decimal part of a number.

Sign Returns the sign of a number.

Pow Returns the power of two numbers.

Log Returns the logarithm of a number.

Sqrt Returns the square root of a number.

Clamp Returns the value of a number clamped between a minimum and a maximum.

Step Returns 0 if the value is less than a threshold and 1 if it is greater.

Smoothstep Returns an clamped smooth interpolation between two values based on a ratio.

Lerp Returns a linear interpolation between two values based on a ratio.

Sin Returns the sine of an angle (given in radians).

Cos Returns the cosine of an angle (given in radians).

Tan Returns the tangent of an angle (given in radians).

Asin Returns the arcsine angle in radians of a number.

Acos Returns the arccosine angle in radians of a number.

Atan Returns the arctangent angle in radians of a number.


Boolean

Boolean values are represented as numerical values. 0 means False, anything else means True.

And Returns 1 if both values evalutate to True.

Or Returns 1 if either of the two values evalutate to True.

Xor Returns 1 if only one of the two values evalutate to True.

Not Returns the opposite of a given boolean value.


Compare

Equal Compares if two values are equal and returns a boolean (0 or 1).

Greater Compares if one value is greater than another and returns a boolean (0 or 1).

Lesser Compares if one value is less than another and returns a boolean (0 or 1).


Functions

Expression Allows you to write a more advanced mathematical expression using XenonCode functions and/or algebra.

Switch Returns different values depending on the input value.

Counter Returns a counter that increments with each call. The initial value, minimum, and maximum can be defined.

Pulse Returns 1 when its input value has changed.

PulseToggle Returns a boolean that toggles between True/False each time its input value has changed.

Text Allows you to write a more advanced textual expression.

PID Controller Returns a PID control value based on the error, integral of the error, and derivative of the error.


Execution

Statement Allows you to write a pure XenonCode statement like a function call. Must output to either a Conditional or an Execute node.

Conditional Consider the given statement only if the given condition evaluates to True. Can be chained with other conditionals.

Execute Executes the connected statements in top-down order.

Include Includes another XenonCode script in the current script. Make sure your variables and constants nodes have unique names.


Timing

Time Returns the current Unix Timestamp in units of seconds, having decimals with microsecond precision.

Delay Returns a boolean 1 after a given delay in seconds after the Set input has received a change from 1 to 0.

Blinker Returns an alternating boolean between 0 and 1 changing at each defined time interval in seconds.

Smooth Returns a value interpolating from the previous target (or 0) to the current target value with a given duration in seconds after the Start input has received a change from 1 to 0.

Archean offers a multiplayer experience, allowing you to open your single-player games to other players or set up a dedicated server.

Hardware Requirements

To ensure the proper functioning of an Archean server in multiplayer mode, the following minimum configuration is recommended:

  • Processor: Prioritize high power per core (i7, Ryzen...)
  • Memory: Minimum of 8 GB of RAM

This setup may change depending on the platform used (Windows, Linux, etc.) and future game updates.

Network

Regardless of the operating system choice, you must ensure that port 8881 is open for both UDP & TCP.

Operating System

Linux

To set up a dedicated server on a Linux server, you will need curl as well as Docker in order to execute the automatic installation script.

Installing Docker can significantly vary depending on the distribution used. We recommend consulting the Wiki of your distribution for guidance on successful installation.

To install the server with the official script, here are the steps to follow:

# Download the install script
curl -s -o install_archean_server.sh https://archean.space/assets/user_scripts/run_server_with_docker.sh

# Make it executable
chmod +x install_archean_server.sh

# Run this script to Install or Update the server
./install_archean_server.sh

Windows

Standalone windows servers are not supported yet, but coming soon.

However, you can host a game while playing it if you configure server.ini with the following:

  • server_online = yes
  • server_public_name = <Any name you want>
  • accept_remote_connections = yes

Then, whenever you hit Play in the launcher, a public server will be listed and others can join.
Again, don't forget to open your port 8881 (or anything have set in listen_port).