New port to a new language (Slang) in progress

Discuss issues specific to miscellaneous ports of Box2D
Villane
Posts: 101
Joined: Mon Sep 01, 2008 6:32 am

New port to a new language (Slang) in progress

Postby Villane » Sun Sep 23, 2012 8:24 am

Hi,

I used to work on the Scala port of Box2D, but at some point I got a bit disappointed with game programming on the JVM and started working on my own language -- Slang ( http://villane.wordpress.com/slang/ )

The goal of the language is to be as fast as C (I hope), support a mix of object oriented and functional programming, with good support for mathematical notation (Unicode). Of course Unicode is hard to type, so later there should be an IDE that lets you write non-unicode aliases, but then converts it to unicode representation when you save (or something along those lines).

So the idea is to make the math behind game programming easily visible. I am not 100% sure if that is a worthwhile goal, but I want to believe that it is.

I'm very new to creating languages, and there are a lot of missing features still, but some tiny parts of Box2D can already be implemented. The math notation enables things like:

Code: Select all

def collideCircles(circleA: Circle, circleB: Circle, xfA: Transform2, xfB: Transform2) = {
  val pA := xfA * circleA.pos();
  val pB := xfB * circleB.pos();
  val r := circleA.radius() + circleB.radius();

  // |v| is v.length(). Eventually the compiler should optimize the sqrt out of the expression |v|²
  if |pB - pA|² > r² then
    /*circles collide, make manifold*/
  else
    /*they don't, make empty manifold*/
}

and ...

Code: Select all

A⁻¹ // inverse of matrix
Mᵀ * vec // take transpose of M and multiply by vec -- 2 operations but should be as fast as a mulT
|M| // determinant of matrix
v1 ∥ v2 // are v1 and v2 parallel?

(you can check out the implementation of 2x2 matrix here: https://gist.github.com/3767858 )

I'm curious if any other ports of Box2D are trying to make the math more visible?

Return to “Miscellaneous”



Who is online

Users browsing this forum: No registered users and 1 guest