Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


EvincarOfAutumn

Member Since 04 Nov 2005
Offline Last Active Dec 16 2014 08:25 PM

Topics I've Started

Hap: a simple concurrent programming language.

14 April 2013 - 03:53 PM

Well, I’ve gone and done it again—written a language when nobody asked me to. This one might be interesting to game developers, and I’m interested to hear feedback from anyone with an opinion about what ought to be done with it.

The language is called Hap and is designed as a readable dynamic language for game prototyping. It uses single-threaded cooperative multitasking to support simple event-based concurrency. The example from the README sums it up nicely:

 

var health = 100;

when (health <= 0) {
  print("Goodbye, cruel world!");
  exit;
}

print("Hello, sweet world!");

while (true)
  health = health - 1;

 

This code prints:

 

Hello, sweet world!
Goodbye, cruel world!

 

Hopefully that’s enough to get your attention. Another example shows how you can use the asynchronous control flow statements to write surprisingly readable code:

 

fun make_cycler(start, end) {

  var current = start;

  whenever (current > end)
    current = start;

  ret lam() {
    var previous = current;
    current = current + 1;
    ret previous;
  };

}

 

This function returns a function generating a cycle of values in the given range. For instance:

 

make_cycler(0, 2)

 

Will produce the sequence:

 

0, 1, 2, 0, 1, 2, …

 

Hap can be used on its own, but the idea is to support embedding in larger systems, much like Lua or JavaScript. Being only a few weeks old, the language naturally has some issues that would need to be addressed before it could be used in production. In particular:

 

  • There is no standard library, and thus no way to perform a number of common math and container operations.
  • Embedding the language is not as simple as it should be.
  • Asynchronous control flow is not first-class, i.e., there is no way to refer to or halt a “whenever” statement.
  • The prototype interpreter is not designed with performance in mind.

 

I will gladly address these and any other issues if there is interest in the general concept. Tell me what you think!


Protodata—a language for binary data

11 February 2013 - 03:20 AM

I recently rewrote and improved some old software of mine, and figured the next step is to put it in the hands of people who might use it.

 

Protodata lets you write binary data using a textual markup language. I’ve found this really useful in game development when I want a custom format, would rather not use plain text or XML, and don’t want to invest the time to make a good custom editor. Protodata supports signed and unsigned integers, floating-point numbers, and Unicode strings, all with a choice of bit width and endianness.

 

Edit: here’s an example document describing a cube mesh.

 

# File endianness and magic number
big u8 "MESH"

# Mesh name, null-terminated
utf8 "Cube" u8 0

# Using an arbitrary-width integer for zero padding
u24 0

# Vertex count
u32 8

# Vertex data (x, y, z)
f32
+1.0 +1.0 -1.0
+1.0 -1.0 -1.0
-1.0 -1.0 -1.0
-1.0 +1.0 -1.0
+1.0 +1.0 +1.0
-1.0 +1.0 +1.0
-1.0 -1.0 +1.0
+1.0 -1.0 +1.0

# Number of faces
u32 6

# Face data (vertex count, vertex indices)
u32
4 { u16 0 1 2 3 } # Back
4 { u16 4 5 6 7 } # Front
4 { u16 0 4 7 1 } # Right
4 { u16 1 7 6 2 } # Bottom
4 { u16 2 6 5 3 } # Left
4 { u16 4 0 3 5 } # Top

 

Please tell me what you think and offer suggestions for improvement. smile.png


Vision Web Template Language

02 May 2010 - 05:04 PM

Hey all. I posted about this in the Web Development forum and got exactly zero responses, so maybe I'll get some more interest here. I just released a new version of one of my language projects, Vision, a small, easy-to-use language for creating Web sites. Vision is something like a Web template system (at least Google says so), rather like PHP. But unlike that abomination, Vision requires separation between a page template and the generators of dynamic content that fill that template. Like using CSS to separate markup from styling, separating templating from content generation is very helpful in creating a robust, modular, and highly maintainable site design. You should check out the original post, read the documentation, browse the Sourceforge project page, and ask me questions here. Any feedback is much appreciated! It's useful to me, so I want to share in case it's useful to you.

[web] Language for Rapid Web Site Development

18 April 2010 - 07:50 AM

Hello all. Anyone who knows me knows I make languages. This one might be of interest to you Web developers. Have you ever been working on a Web site where you need a bunch of similar pages with different content? Sure, that's where you could use a preprocessor like PHP! But wait a minute. You just wanted to make a quick Web site here, and PHP is rather overkill, isn't it? What if all you want to do is make some templates and have them automatically filled in with your content? Enter Vision. Vision is a lightweight language for the specific purpose of prototyping Web sites. It lets you quickly create basic page and fragment templates and have them automatically filled in with content from other files, be they (X)HTML documents or fragments, or Vision code. Here's a basic template:
    @define MyTemplate(TITLE; BODY) {
        html {
            head { title { TITLE } }
            body { BODY }
        }
    }
Here's a Vision document that uses it:
    #!/usr/bin/vision
    @include MyTemplateFile;
    MyTemplate {
        "My Web Page!";
        content/MainPage.htm
    }
And here's the content it includes:
    <h1>Welcome to my Web page!</h1>
    <p>This is an arbitrary HTML fragment.</p>
Unlike more heavyweight solutions like PHP or a full CMS, Vision lets you retain much more precise control over your source code. Further, Vision can be used to generate any XML fragments you want (or any textual content, really), so it's perfectly suitable for responding to an AJAX request. And that's just the beginning. You should check it out and read the documentation to see if it's right for you! Vision has worked very well for me and I want to share it with others who may find it useful. I appreciate any feedback you can give, positive or negative, since it can only make the software better. Thanks in advance, and have fun!

Language for Rapidly Prototyping Binary Files

16 April 2010 - 04:23 AM

In the past, when I've needed to make custom binary data files but wanted something slightly more flexible than a hex editor, I cracked open my assembler, added a bunch of 'db' statements to get the bytes I needed, and assembled the whole thing into what I actually wanted. This was cumbersome and awkward, and I felt like there was a better solution. So I made one. I call it Protodata, and it's super handy for prototyping custom binary file formats, as you may often find yourself doing in game design. It's currently in alpha and there are some issues, but it's usable and I'd appreciate feedback. There's a Windows binary that should run anywhere and it's easy enough to build the source file. Yes, just the one. I intend to add support for specifying endianness, character encoding, and shorthand definitions for repeated structures. Let me know what else is broken and what you'd like to see added. Check out the Sourceforge project page and the project home page for more information.

PARTNERS