This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
helo's profile picture

What are these "operating systems" and how do I make one?

Started by helo, 06 May 2018 - 04:28 AM
helo #1
Posted 06 May 2018 - 06:28 AM
Hi guys, helo here. I've been wondering about these "operating systems" that pop up on the forums, and well, they confuse me a little. What are they, what are their point and well, how do I make one? A note if it helps, I use the latest 1.12 version of ComputerCraft, and I've had little experience with the mod or Lua at all. Thanks! ^-^
Marc1miner #2
Posted 08 May 2018 - 03:36 AM
An operating system is basically the software your computer runs when it boots, like Windows, Linux and Mac.
Their point is to make computers' basic functionality far better and better for use, like a file system where all files that are user created can be found etc.
How to make one is up to you, what functionality do you want your computer to have?

Some things I find useful are:
- Basic login screen, with users and passwords (also adds a challenge how to store them and keep them save, assuming you're doing mp)
- User interface (like files displayed etc.)
- Basic peripheral attachment and detachment

How to start such project.

First of all, what is your knowledge of lua?
Assuming you know the basics you should start by editing the startup file
You can do that as follows
type this in the computer
edit startup

Then as a test you can type for example
print("test")
then save it and it should print test every time you boot your computer

then you can write there whatever you want and it will run when you start your computer
my advice is to use your startup file as a selector, you select from there what you want to run

here a little example of a selector

function main(int)
if int == 1 then
os.run("ex1")
return true
elseif int == 2 then
os.run("ex2")
return true 
else
return false
end
end
while true do
  input = read()
  input = tonumber(input)
  if main(input) == false then
  print("Program does not exist")
  end
end

I hope this clarifies a lot for you and if you have any question feel free to ask them
KingofGamesYami #3
Posted 08 May 2018 - 07:43 AM
Please consider making something more interesting than yet another "Operating System". A game is a much better first project.

However, if you must, I recommend taking a look at the source of the more popular OSs.
EveryOS #4
Posted 08 May 2018 - 02:58 PM
Please consider making something more interesting than yet another "Operating System". A game is a much better first project.
I Absolutely Hate it when people say that.

Operating Systems are the best thing ever

Honestly, you should greatly study the lua manuals (Different manuals for different versions), and then continue writing it. When you finish, you should re-write it a few times, greatly bug test it, and then post it.

EDIT: though *nowadays* I do agree it should be an actual OS, not just a GUI. I'm not very proud of mine and Sewbacca's original NyanOS (a GUI)

But you should definitely take a year or two to write an actual OS.
Edited on 08 May 2018 - 04:08 PM
Dog #5
Posted 08 May 2018 - 03:54 PM
Please consider making something more interesting than yet another "Operating System"…

I second KOGY's sentiment. Further, if you're new to programming, an 'operating system' is going to be a terrible first project for a variety of reasons. You won't have a finished product for quite awhile (you'll be working for weeks or months without being able to release anything) and you'll be dealing with advanced concepts that, as a new programmer, you will probably struggle with quite a bit just to grasp. On top of that, unless your 'OS' has something special that all the other 'operating systems' don't have, it isn't likely to gain much traction as the forums already have a wide selection of shells, GUIs, and OS's.

However, if you really want to make an 'OS' in CC (and not just a glorified GUI) then you'll definitely want to be familiar with Bomb Bloke's Guide to Coroutines.
EveryOS #6
Posted 08 May 2018 - 04:13 PM
You won't have a finished product for quite awhile (you'll be working for weeks or months without being able to release anything) and you'll be dealing with advanced concepts that, as a new programmer, you will probably struggle with quite a bit just to grasp.

Well, I guess I can agree there, I myself am writing an OS too and even with my experience it is quite a nightmare to work with. It's way too time-consuming.
KingofGamesYami #7
Posted 08 May 2018 - 06:03 PM
My point was that an OS is a terrible first project. It can be a good project, but it takes a very long time to complete and requires some degree of skill. Writing a few sizable programs (ei a couple hundred lines) before starting will give you a much better idea of what you can and cannot do, and how to structure such a large project with potentially thousands of lines.
CLNinja #8
Posted 08 May 2018 - 06:18 PM
My point was that an OS is a terrible first project. It can be a good project, but it takes a very long time to complete and requires some degree of skill. Writing a few sizable programs (ei a couple hundred lines) before starting will give you a much better idea of what you can and cannot do, and how to structure such a large project with potentially thousands of lines.
I absolutely agree with this, mostly.

An OS isn't a good starting project if you're trying to make a GOOD project, however, most people seem to tell people altogether, do not make operating systems, we have too many, etc, etc.

I think if something is fun for you to make, make it if you want, just don't expect praise or good reactions from the community.
MarcoPolo0306 #9
Posted 08 May 2018 - 06:45 PM
NDFJay's OS tutorials are very helpful, as I used this tutorial to make my OS's.

I have programmed in Lua for several years, and as others stated above, it may not be a very good first project. I find it fun, if I didn't then why would I be doing it?

Hope this helps!
EveryOS #10
Posted 08 May 2018 - 11:44 PM
Though you do not want to write a copy-off. Writing an OS should take at least a few months.
CLNinja #11
Posted 09 May 2018 - 04:32 AM
NDFJay's OS tutorials are very helpful, as I used this tutorial to make my OS's.

I have programmed in Lua for several years, and as others stated above, it may not be a very good first project. I find it fun, if I didn't then why would I be doing it?

Hope this helps!
If you're going to use this, DO NOT copy straight from it. Expand and do something different, because there were at one time about 50 clones of this.
EveryOS #12
Posted 09 May 2018 - 01:14 PM
NDFJay's OS tutorials are very helpful, as I used this tutorial to make my OS's.

I have programmed in Lua for several years, and as others stated above, it may not be a very good first project. I find it fun, if I didn't then why would I be doing it?

Hope this helps!
If you're going to use this, DO NOT copy straight from it. Expand and do something different, because there were at one time about 50 clones of this.
I think I beat you to saying that.
Though you do not want to write a copy-off. Writing an OS should take at least a few months.
Dave-ee Jones #13
Posted 10 May 2018 - 01:27 AM
Making an OS can be the best thing you do once you've learned the basics

First project I would recommend doing is a simple doorlock program - everyone starts there, and it's super easy to build off. Look into rednet client/server for authentication, look into making a nicer GUI (with colours!), look into using mouse events to make the GUI more interactive, look into making coroutines or windows for multiple settings and a user-friendly GUI.

You only need half of the above knowledge to make a decent-looking "OS".
EveryOS #14
Posted 10 May 2018 - 01:30 PM
First project I would recommend doing is a simple doorlock program - everyone starts there
Exception: Me, I went straight to Operating Systems…
H4X0RZ #15
Posted 12 May 2018 - 12:20 PM
Though you do not want to write a copy-off. Writing an OS should take at least a few months.

That's a terrible generalization. Neither will you ever achieve true OS-esque programs. It'll always be a glorified shell with a bunch of utility programs; You don't have to do any of the low-level stuff an actual OS would be doing. CC isn't designed for this "OS" market anyway IMO.
Restioson #16
Posted 12 May 2018 - 02:35 PM
Though you do not want to write a copy-off. Writing an OS should take at least a few months.

That's a terrible generalization. Neither will you ever achieve true OS-esque programs. It'll always be a glorified shell with a bunch of utility programs; You don't have to do any of the low-level stuff an actual OS would be doing. CC isn't designed for this "OS" market anyway IMO.

Okay, let's be fair. You can write the userland of an OS (of a monolithic kernel OS), as CC doesn't expose the lower level details like memory management (paging, etc), port io, MMIO, PCIE, ACPI, etc. In fact, as pointed out by SquidDev it doesn't *have* them in the first place. What you're left with is essentially just the desktop environment (or if you don't have a desktop, then just the environment) of an OS.
Edited on 12 May 2018 - 12:43 PM
Bomb Bloke #17
Posted 12 May 2018 - 02:39 PM
That's what H4X0RZ is saying - in computing terms, a shell is "the userland of an OS".
CLNinja #18
Posted 12 May 2018 - 05:02 PM
That's a terrible generalization. Neither will you ever achieve true OS-esque programs. It'll always be a glorified shell with a bunch of utility programs; You don't have to do any of the low-level stuff an actual OS would be doing. CC isn't designed for this "OS" market anyway IMO.
I'd like to point out that an "OS" can be much more than just a shell. Vorbani for example is a complete overhaul of CraftOS and changes how CC itself works (on the users end)
Restioson #19
Posted 12 May 2018 - 08:07 PM
That's what H4X0RZ is saying - in computing terms, a shell is "the userland of an OS".

<snip, sorry pako>
I'd like to point out that an "OS" can be much more than just a shell. Vorbani for example is a complete overhaul of CraftOS and changes how CC itself works (on the users end)

A shell isn't necessarily the *only* thing an OS's userland can have. It could have a windowing system or a GUI toolkit for instance. CC "OS"es do tend to just include new shells though.