[Mod] Lua Computers [datamine]

Post Reply
Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

[Mod] Lua Computers [datamine]

by Byakuren » Post

Datamine

Github: https://github.com/raymoo/datamine

This is a mod implementing computers that behave like real computers, maintaining their execution state. You do not need to save your values in a memory table or manually yield anywhere. For an example of what kind of code you can safely (hopefully) run in the computer, take a look at https://github.com/raymoo/datamine/blob/master/os.lua.

Features:
  • Digilines support
  • Preemptive scheduling - Doesn't hang the server over "while true do end".
  • Concurrency - The computers support running multiple processes and scheduling between them.
  • Text IO - Computers come with a line input and a console screen.
  • Sandboxing - Programs executing in the computer (hopefully) do not have access to the mod environment. Memory use is also limited.
Planned Features (More question marks = more uncertainty):
  • Restart button - In case your computer is stuck.
  • Boot drive - So you have something to run.
  • A hard disk device of some kind
  • Synchronization stuff
  • Internet??
  • Cloud computing??????? - Disembodied computer instances that aren't tied to a physical node, and which share execution shares with the instances of other players.
  • More things in the programs' global environment.
Building/Installing
There is no release yet. The mod uses a custom C module, so requires special building instructions (check the README on Github). Once you have built the module, you can use it like any other mod.

Use
Use "/giveme datamine:computer" to give yourself a computer, and place it in the world somewhere. If you right-click it, you will see that it has booted up. Computers will shut down automatically and forcefully when they are unloaded, but they can be turned back on with the input button.

Currently, the computer runs a simple OS that only supports echoing the user's input back.
Last edited by Byakuren on Sun Nov 13, 2016 21:38, edited 1 time in total.
Every time a mod API is left undocumented, a koala dies.

User avatar
Desour
Member
Posts: 1469
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] Lua Computers [datamine]

by Desour » Post

sound interesting
screenshots?
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Lua Computers [datamine]

by Byakuren » Post

DS-minetest wrote:sound interesting
screenshots?
There isn't that much to show since currently the computer has no way to run anything but the test OS (which hasn't been programmed to load user-supplied programs). But here's a screen shot of me interacting with it:
Spoiler
Image
The source code for this version of the OS is at https://github.com/raymoo/datamine/blob ... 552/os.lua. It uses a few of the mentioned features, including forking processes, text input/output, and digiline support.
Attachments
screenshot_20161113_132946.png
screenshot_20161113_132946.png (228.25 KiB) Viewed 507 times
Every time a mod API is left undocumented, a koala dies.

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Lua Computers [datamine]

by Wuzzy » Post

Great!
Now let's port Linux to those Lua computers, which we then use to reimplement Minetest, in which we use this mod again to port Linux, which we use to reimplement Minetest again in which we use even more Lua computers …

User avatar
bigfoot
Member
Posts: 203
Joined: Fri Sep 02, 2016 23:31
GitHub: bigfoot547
IRC: bigfoot547 or bigfoot
In-game: bigfoot547 or bigfoot
Location: Somewhere between polar bears and penguins.

Re: [Mod] Lua Computers [datamine]

by bigfoot » Post

Wuzzy wrote:Great!
Now let's port Linux to those Lua computers, which we then use to reimplement Minetest, in which we use this mod again to port Linux, which we use to reimplement Minetest again in which we use even more Lua computers …
Or, we could write "recursive" or "circular reference" in the chat :-D.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 16 guests