Fighter Game / UglyScript
Posted: Tue Dec 24, 2013 8:59 pm
I'm currently working on a fighter game. There's nothing much to say about it other than it's my winter break project.
Here's the editor I made for it. I'm not using LoveFrames, so the GUI is built from the ground up.
I coded it completely in UglyScript, a scripting language that I created.
For a few months I've been working on a scripting language that translates to Lua. I really loved the idea of MoonScript expanding the already powerful Lua with more intuitive syntax. But I wasn't satisfied with MoonScript at all, because it turned out looking like befunge or brainfuck, and even though it did add features to Lua that Lua was missing, MoonScript became way less legible than Lua. So I made my own language called UglyScript with the goal of being legible and intuitive without destroying core features of Lua.
This is an example of UglyScript being translated into Lua.
The file on the right is pretty ugly right?
Features:
Here's the editor I made for it. I'm not using LoveFrames, so the GUI is built from the ground up.
I coded it completely in UglyScript, a scripting language that I created.
For a few months I've been working on a scripting language that translates to Lua. I really loved the idea of MoonScript expanding the already powerful Lua with more intuitive syntax. But I wasn't satisfied with MoonScript at all, because it turned out looking like befunge or brainfuck, and even though it did add features to Lua that Lua was missing, MoonScript became way less legible than Lua. So I made my own language called UglyScript with the goal of being legible and intuitive without destroying core features of Lua.
This is an example of UglyScript being translated into Lua.
The file on the right is pretty ugly right?
Features:
- Syntax inspired heavily by Javascript and C++
- Blocks and statements are wrapped in {}
- class and class inheritance. you can use self.super to call super methods.
- new keyword for creating new instances of a class
- continue keyword for loops
- for (local x;x;x++) {} loops
- $ translates directly into "__" so you can have "jquery"-esque syntax.
- Self-incrementing/decrementing using var++ or var--
- Self operations using var+= or var*=
- Bitwise operators |, &, <<, >> but they're translated into function calls. You have to define the functions yourself.
- Comments can be created with either // or /* */
- Tables and Arrays can be defined with either { } or [ ]
- Strings can have multiple lines
- keys in a table can be defined as {key1: "test", key2: "test"}
- or {key1 = "test"}
- or {["key1"] = "test"}
- You can use any word to describe local variables. I use "class names" but you're allowed to use local, var or whatever suits you.
- You can define functions the same way, void blah () { } or int blah () { } or function blah () { }
- to define a local function, you need to put "local" in front of the function definition.
- anonymous functions are also supported.
- One line blocks. you can do if (blahblah == true) return true; without using curly brackets.
- The "." operator translates to ":" if being called as a function, otherwise to "."
- The "::" operator always translates to "." and acts as a namespace operator.