Skip to content
Florian Nücke edited this page Dec 4, 2013 · 15 revisions

Welcome to the documentation of OpenComputers!

This wiki is organized into four parts:

OpenComputers is a mod that adds computers and robots into the game that can be programmed in Lua 5.2. It takes ideas from a couple of other mods such as ComputerCraft, StevesCarts and Modular Powersuits to create something new and - hopefully - interesting. Here a few key points.

Persistence

Programs will resume where they were stopped when the chunk with the computer they run on was unloaded and reloaded later. This is particularly useful for single player, servers where you can't spam chunk loaders and last but not least Redstone in Motion frames. OpenComputers achieves this by persisting the actual call stacks of all running coroutines. This is the reason OpenComputers cannot use a Java implementation of the Lua VM, since those all use Java threads as far I'm aware, which cannot be persisted. Therefore:

Important: OpenComputers requires a native library - the Eris library, specifically. This includes the official Lua VM implementation. However, only the server requires the library. Clients do not. All Lua code is executed purely on the server. Please also see Dependencies.
Currently the library is distributed with the mod for Windows and Linux (tested on Linux Mint). If you think you're capable of compiling it as a dynamic library for Mac OS, please get in touch.

Modularity

You can add and remove components such as expansion cards and hard drives. This means it takes a little more effort to get your first computer, but adds a whole new level of flexibility. For example, you could build a pure "server" by having a computer that only has a network card, but no graphics card.

Resource Limits

Besides the obvious limitation of disk space, computers also have a limited amount of RAM. You'll actually have to keep this in mind when writing your programs, since low end computers can run out of memory pretty quickly.
This also makes computers quite server-friendly, since it's less likely for them to strain the server unduly. A few more limits are in place to further enhance server performance: OpenComputers does not have to spawn a new thread for each coroutine. Instead, it uses a fixed number of low-priority worker threads to drive all currently loaded and running computers. Computers are also forced to yield regularly (per default within one second) to avoid them blocking the worker threads. If they fail to do so, the computer will "crash".

Power

Computers and certain components need power to operate. For example, computers and screens require a constant amount of energy per tick to continue running / displaying. If there is not enough power, computers will crash / stop. Graphics cards consume energy when modifying the screen they are bound do, the amount of energy being consumed depending on the size of the area that is changed. Wireless network cards consume energy when sending wireless messages, based on the used signal strength. Robots use energy to move and perform other actions.

There is - except for a robot upgrade - no built-in mechanic for generating power at this point, so you'll want to use this mod together with others. OpenComputers can convert power from BuildCraft, IndustrialCraft² and Universal Electricity using the Power Converter block.

Connectivity

In OpenComputers there are item and block components, i.e. "things that can be seen from Lua".

Block components can be seen from computers that are connected to the block by being next to it, or indirectly by any number of other blocks from this mod. If you know Applied Energistics, that's basically how it is. For example, if a screen is next to a power distributor which is next to a computer, the computer can still see the screen, because it is connected to it via the power distributor. The cheapest way of connecting blocks this way is the cable block.

Item components can usually be only seen by the computer they're installed in. An exception to that rule are floppy disks in disk drives, which behave like a block component.

See the page on component interaction to learn how to communicate with components from Lua.

Configurability

Almost every aspect of the mod can be tweaked via the configuration file. Not a fan of computers requiring power to run? Set their running cost to zero. Don't want power to play a role at all? Disable it completely! Think robots move too slow? Make 'em faster. Want bigger multi-block screens? Increase the maximum size. Just have a look at the default configuration file to see all the options. They are hopefully well enough documented.

Dependencies

The native library has a few - very few - dependencies.

In the most cases you'll already have these dependencies installed.

Clone this wiki locally