Fighter Game / UglyScript

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
qwook
Prole
Posts: 40
Joined: Fri Dec 13, 2013 5:53 am

Fighter Game / UglyScript

Post by qwook »

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.
Image

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.
Image
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.
Getting UglyScript to play well with Love2D is quite a pain, and you need a really specific workflow to get it going. Because of that, it will be a while before I release UglyScript.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Fighter Game / UglyScript

Post by Roland_Yonaba »

This sounds awesome. I like the concept.
But I don't think the name should be related the Lua output. Since the syntax is quite pretty, I won't vote for UglyScript.
I see the file extension you chose is '.sun'. Why not calling the language 'sun' ?
That would be quite fun, because Lua already means 'Moon' in portuguese, and it originated from SOL (and DEL), which already meant 'sun', still in portuguese...

Concerning the syntax, even though it looks nice, I don't feel like I am going to use it. Yes, there are some features borrowed from some languages that would be nice to have with Lua. I reckon that. But JS syntax doesn't looks as nice as Lua's, to me. :)
Anyway, keep it going, it looks really nice.
User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: Fighter Game / UglyScript

Post by Murii »

This is really nice i`m looking forward to it!
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Fighter Game / UglyScript

Post by Germanunkol »

The GUI also looks really nice. Is it built in such a way that it could be shared as a library?
Or is it all written in ugly script - so sharing the .lua files wouldn't be any easy-to-read library?
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
User avatar
qwook
Prole
Posts: 40
Joined: Fri Dec 13, 2013 5:53 am

Re: Fighter Game / UglyScript

Post by qwook »

Germanunkol wrote:The GUI also looks really nice. Is it built in such a way that it could be shared as a library?
Or is it all written in ugly script - so sharing the .lua files wouldn't be any easy-to-read library?
It is definitely built modularly, so you can load in the .lua files without having the UglyScript files, but you might be forced into using my class system.

Also, the legacy name was SunScript, but I jokingly called it UglyScript. I might continue calling it UglyScript because of SEO reasons and a domain using UglyScript is easier to find.
Roland_Yonaba wrote:Concerning the syntax, even though it looks nice, I don't feel like I am going to use it. Yes, there are some features borrowed from some languages that would be nice to have with Lua. I reckon that. But JS syntax doesn't looks as nice as Lua's, to me. :)
Anyway, keep it going, it looks really nice.
Really, the only thing borrowed from JS syntax is the ability to use "$". Everything else has been borrowed from C++, and I originally started designing this with the idea of being able to load C++ code into Lua as a form of "hot swapping".
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest