LuaComputers Progress

in #programming7 years ago

Let me introduce you to my current Project

So basically I am currently programming LuaComputers, a program which allows you to start a "virtual retro-like computer" and program games and software in Lua with it. (It's heavily inspired by a Minecraft mod called "ComputerCraft")
It has a resolution of 320x200 (as I said, "retro-like"), (currently only) sockets for networking (basically direct UDP/TCP connections to other LuaComputers) and audio support (load and play audiofiles) and will later get support for HTTP requests.

What currently works:

  • Graphics API (name: "gpu") - Allows you to interact with each individual pixel on the screen
  • Audio API (name: "audio") - Allows you to load and play audio files. When playing you can also pitch, pan and change the volume of them. (currently you cannot change them while they're playing)
  • Networking API (name: "networking") - Allows you to send messages to a specific IP address, however, you cannot set the port and whatnot so you can only communicate with other LuaComputers running on the internet. You can also disable the virtual "network adapter" so you won't be able to receive and send messages. (Kinda prevents exploits, if there even are any? Idk...)
  • Filesystem API (name: "filesystem") - Allows you to interact with the computer's filesystem (located in [HOME_DIRECTORY]/Documents/LuaComputers/; yes, it has to be called Documents (well windows translates it automatically) and there must be at least the folder LuaComputers so that it won't crash with a nasty error)
  • Loading init.lua: init.lua is a file located in the root of the computer's filesystem (see above) and gets executed when the computer gets started, it is basically the lowest file the normal user is able to access and has just the basic APIs in it's global environment (_G) (lowest APIs == the APIs I listed above)

What is planned:

  • HTTP API (name: "http", I guess?) - Will allow you to send http requests (maybe if people are interested in my program , they might want to program a retro-webbrowser? Who knows...)
  • MAYBE "Make" sounds using PCM (name: no name currently) - Would allow you to send an array of data to your soundcard through PCM, which will create sounds out of it, however, I don't know anything about it tbh and when I tried it (I use libGDX) I got super confused and removed it
  • A basic "operating system" for it, as currently there is no way to interact with the computer from inside itself (maybe something like a shell)

What currently is buggy / might not work:

  • As the program uses 4 threads in total (yeah, sorry.. 2 for the network, 1 as the main loop and 1 as the emulator loop (LUA) ) there might be glitches where they get out of sync, however, I am 80% sure that I synchronized everything that has to be synchronized..
  • As you can see in the graphics test video below, drawing is fast and has no delay (I moved my mouse very quickly in the end) but there might be some performance issues that I haven't discovered
  • The biggest program currently for me is the audio API: As you might have noticed (don't know if it's hearable in the video), every time a sound effect gets started, there is a small crack at the beginning of the sound and I don't know how the hell I am supposed to fix this (it is not an issue of the sound file, it's 100% coming from the API), but I did not test this on other computers yet

I also have 2 testing videos on graphics and audio

Graphics

Audio

What I used

  • Language: Java
  • Framework: libGDX (video, audio)
  • Networking: Built-in Java sockets

Anyway, thanks for reading and if you are interested in testing this program or have any suggestions, just comment below and I'll send a download link.

Oh and please vote this post up or follow me if you like this type of content, it would really help me. (Yeah I am asking for it because I'm new and basically have no audience)