What it's like to code for Roblox
Our son is heavily into two things on the computer right now: Minecraft and Roblox. Of these I only knew about Minecraft before, while Roblox I knew nothing about. Now that I know it better, how would I describe it? It's a bit like Second Life was, a place with user-generated places that you can visit. But not one continuous place, rather you choose what you want to do first, and each 3D experience starts only after that. Most of the places you can visit are created by kids, so it's a really imaginative world. Everything is cross-device multiplayer by default.
After visiting Roblox worlds together, I started noticing that besides being fun 3D environments, each place often had its own rules as well, but much more complicated than most people would have patience for creating from Minecraft logic blocks. So there must be some way to write code on Roblox as well, how does that work? So I downloaded the separate Roblox editor called RobloxStudio to look at how these worlds are created.
After playing around it for some time — actually for over two months at it this point — I'm very impressed with it. I expected something really basic, but RobloxStudio is actually a proper IDE similar to Unity. It doesn't allow you to do everything that Unity would (you can't write shaders for example), but the basic idea is the same. You import 3D models (from Blender via .fbx files in my case), and create scenes out of them.
The secret to why even kids can easily get into the editor (our 5-year old can use it) is that importing 3D models created by others is super easy. You can visually browse models inside of the editor, and import them into your scene with one click. After you get used to this, the way asset packs are imported to Unity starts to seem really kludgy.
Besides creating scenes out of 3D models, you can also script them by writing code. For Roblox, the code is written Lua, which is the same language that is used to script games such as Civilization V, Factorio, Noita, and Dark Souls. I mostly wrote Python before, but getting into Lua was easy, and pleasantly IDE has a decent code editor with features such as setting breakpoints and "jump to definition".
But there is one feature that left me really impressed with RobloxStudio: how much easier it makes network programming.
Because Roblox games are all multiplayer, to create them you end up needing to think about server- and client-side logic. You'll have the server deciding the overall rules of the game, while the client-side code can do things like UI, frame-by-frame visual changes, responding to things like button clicks without lag, and changing the environment when only one player should see the change. Beautifully both of these sides are written in Lua, and as they both manipulate the same data (called the "data model") describing the current state of the game, you can often use the same code on both sides!
Since I'm pretty deep into this, I could write hours about this subject, but I'll leave things here for now. Let me know (@bemmu or me@bemmu.com) if you'd like me to write more about this.