Call to JVM library developers: upload sources to Maven repos

June 30, 2009 by Erkki Lindpere

I wish all developers that release libraries for the JVM platform (Java, Scala and other libraries) and put their libraries on Maven repos would also put the sources there. It makes it so much easier to get sources automatically attached in an IDE without going digging for them. Maven doesn’t do this by default, but building (and deploying) the sources Jar along with the binary Jar should be a matter of adding these settings to your library’s POM (or better yet, to a parent POM if you use a parent which defines commons settings).


<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-source-plugin</artifactId>
  <executions>
    <execution>
      <id>attach-sources</id>
      <goals>
         <goal>jar</goal>
      </goals>
    </execution>
  </executions>
</plugin>

P2 Still Not Awesome

June 26, 2009 by Erkki Lindpere

P2 has surely seen a lot of improvement in Eclipse 3.5, but some functionality that was actually somewhat acceptable in the old Update Manager is still lacking awesomeness. I’m trying to install VE into Galileo (Eclipse for Java + M2Eclipse + Subclipse + Scala IDE).

There are two usability issues with this. The first is that after selecting the “Visual Editor” feature from the site, I don’t have a “select dependencies” option. But from past usage of VE I remember that it requires Java EMF Model. So I select that too. A new user would not know to select this. I’ll have to navigate to the next page to find out if there are unresolved dependencies. And then we come to the second problem, which is this screen:

P2 unresolved dependencies

Am I really supposed to decipher this text and take action based on that? No thanks, I’ll just skip installing VE this time, I don’t have actual need for it right now.

ScalaBox2D is getting SVG support

June 17, 2009 by Erkki Lindpere

ScalaBox2D is going to get an SVG scene importer soon. This will let you draw a scene in Inkscape and load it as a Box2D world in ScalaBox2D. I already pushed a very basic version of this to GitHub. It uses Slick’s SVG parser and has many limitations as of now, but you can already draw a Scene like this:

SVG Drawing

Inkscape SVG drawing

And bring it to life in a ScalaBox2D application:

ScalaBox2D Scene

ScalaBox2D scene

Currently every circle, box or polygon that has a red (#ff0000) fill will be turned into a dynamic body, the rest will be static bodies. There are also some limitations to the shapes, including: polygons must be convex, and have at most 8 vertices (or they’ll become static edges). Ellipses/arcs are not supported, only circles. You may get exceptions when loading some shapes.

The goal right now is to make this as robust as possible, so you can run the ScalaBox2D testbed and load (almost) any SVG file saved by Inkscape into it. After that, I’ll add support for loading scenes from game code and tying the physical bodies to game objects.

The code for the app looks like this:


import org.villane.box2d.svg._
import org.villane.box2d.draw.DrawFlags._
import org.villane.box2d.testbed.slick._

object SVGApp {
  val scale = 15

  def main(args: Array[String]) {
    val loader = new SlickSVGSceneLoader("C:/drawing-1.svg", scale)
    val world = loader.create
    val flags = Shapes
    SlickDisplayWorld.runWithSimulation(world, false, flags)
  }

}

ScalaBox2D performance problems solved

May 30, 2009 by Erkki Lindpere

Turns out I had a small bug in the broad phase collision detection that caused all the performance problems. It is now fixed and the speed is now roughly equal to JBox2D.

URL Alphabet

May 26, 2009 by Erkki Lindpere

When FireFox 3.0 (or was it 2.0 even?) added the new location bar, I was initially not so happy with it. But I got used to it pretty quickly and now it saves me a lot of typing when I want to visit my favourite sites. Typing one letter is usually enough. I thought I’d write down the whole English alphabet and what the location bar shows first for each letter. I think this sums up my current interests pretty nicely. Except some sites in this list are not really my favourite, they just happen to start with an uncommon letter.

Update: Oh man, I’m so behind the times. Seems that this was a meme in 2006.

A is for http://adventuregamers.com/

B is for http://www.box2d.org/forum/

C is for http://city24.ee/ (real estate portal)

D is for http://dzone.com/

E is for http://eurogamer.net/

F is for http://frictionalgames.com/forum/ (still checking every now and then to see if someone solved the mystery)

G is for http://google.com/ (surprise!)

H is for http://hansa.ee/ (although they are now SwedBank, I still use the old URL out of habit)

I is for http://www.idlethumbs.net/ (in it’s current incarnation an awesome video game podcast by Chris Remo, Jake Rodkin, Nick Breckon and occasionally Steve Gaynor)

J is for http://jazz.net/

K is for http://kv.ee/ (real estate portal)

L is for http://localhost:8080/ :)

L is also for http://listofdomainnamespointingtoidlethumbsdotnet.info/

M is for http://mail.google.com/

N is for http://news.google.com/

O is for http://www.offworld.com/

P is for http://planeteclipse.org/ (and some other planets follow)

Q is for http://www.infoq.com/

R is for http://rockpapershotgun.com/ (the best of PC-focused games journalism)

S is for http://scala-lang.org/

T is for http://twitter.com/

U is for … wow. Nothing interesting for U

V is for http://villane.wordpress.com/wp-admin/

W is for http://wired.com/

X is for http://xkcd.com/

Y is for http://youtube.com/ (another big surprise!)

Z is for http://www.escapistmagazine.com/videos/view/zero-punctuation (awesome video game reviews by Ben “Yahtzee” Croshaw)

What’s your URL alphabet?

ScalaBox2D Physics Engine source available

May 18, 2009 by Erkki Lindpere

The source code for my Scala port of Box2D is now available at GitHub. There is not much support or documentation at the moment. For now, use only if you already know Box2D or really need a physics engine written in Scala :) More documentation and better user experience will be coming in the future.

I am working on the performance, but currently it is about two times slower than JBox2D (which you can also use from Scala).

Get the source code here. And a little information on how to build and run the testbed is available on the Wiki.

Eclipse finally defaults to UTF-8? In my dreams

May 3, 2009 by Erkki Lindpere

Do my eyes deceive me? How the hell did this happen:

Eclipse defaults to UTF-8?

Eclipse defaults to UTF-8?

This happens in an Eclipse Galileo milestone (3.5M6), I can’t remember which exact package I downloaded, because I required some unusual combination of plug-ins.

If it was truly the case that UTF-8 is now the default, it would be awesome, because often programmers forget to change the default setting when creating a new workspace and end up committing something in an encoding specific to their machine. Which is guaranteed to cause pain at some point.

Unfortunately I think this is probably just a bug, because I downloaded another 3.5M6 package and it still defaulted to my region-and-operating-system-specific encoding. And even if I create a new workspace with this instance of Eclipse, it will also default to the other encoding. I wonder what exactly could have caused this instance to default to UTF-8 for a particular workspace…

The Improved Scala Eclipse Plugin

February 20, 2009 by Erkki Lindpere

For the last few days I’ve been working on an Eclipse plug-in using a combination of mixed Java/Scala projects. That is, the same source folder contains both Java and Scala files. I think it’s awesome that this is finally working! At least I wasn’t aware if it was working before. There are still bugs in the Scala Plug-in for Eclipse, but the integration with JDT is now a lot better than before, thanks in part to Equinox Aspects as I understand. You can get the 2.8.x branch of the Scala plug-in, which contains the improvements, from the nightly builds update site.

Also, I noticed a curiosity: I wrote the most complex parts of the mixed projects in Scala, but I mostly created bugs in the comparatively trivial Java code. The Scala code ended up almost bug free from the start, even with hours and hours of coding without actually running the code. Is it really harder to create bugs in Scala? I’d like to think so.

My Head Asplode

February 18, 2009 by Erkki Lindpere

For some reason I decided to count the programming projects I’m more or less working on in my spare time and counted more than I thought.

Some Eclipse related stuff:

  • Bulletin Board API for the Eclipse Communication Framework. Recently did a major refactoring, needs some more updating to get all the features working again. (Java)
  • Padclipse, a “lite” packaging of Eclipse which includes only the Text Editor and a bit more, plus some custom additions. I haven’t really worked on it for a year and a half, but I want to update it when 3.5 comes out. (Java)
  • Eclipse plug-in to make 2D game development with Slick a bit easier. I was working on this for the past two weeks, just finishing up now and will release in a few days. (Java)
  • A secret Eclipse plug-in. Just started, will see if something good comes of it. (Java, likely some Scala too)

Server and game related stuff:

  • Ziggy, the forum bot that runs interactive fiction games, uses BB API. (Scala / Java)
  • Web interface for managing Ziggy, barely started. (Scala, PHP)
  • Scaler, a web framework, too little done to talk about. (Scala)
  • STON, a strongly typed and extensible JSON-like data format. Not sure of the usefulness. (Scala)

2D Game related stuff:

  • Scala port of the JBox2D physics engine. Almost done, but needs polishing. (Scala)
  • Gamp, a game entity system based on Slick and my Box2D port. (Scala)
  • Orbitum, a game making use of Gamp. (Scala)
  • A secret 2D platformer game, but I have barely started with this so perhaps it doesn’t count. (Scala)
  • Another game project, also secret. (Scala)

And this is not all. I occasionally work on quite a number of smaller things, some are just little experiments, others just for excercise. Some may become “projects”, some may not.

Looking at the list almost makes it seem unmanageable to me, but actually I don’t think I’m doing that bad, although there certainly have been release dates promised that haven’t been met. Now I know I should always multiply my time estimates by the number of projects I’m working on :) Only two of the projects are actually released/in production, and beta at that: Ziggy and Padclipse. At least two should have a release rather shortly: the Slick Eclipse plug-in and Scala port of Box2D. But even as I can move them out of the “yet unreleased projects” list, they are still going to need maintenance and updates.

Anyway, please comment, if you are also a programmer, or a geek with a different specialization, who has a lot of hobby projects, how do you manage not to get swamped with them or get the feeling that you are always working on cool stuff but never releasing? I was actually stressed by this a year or more ago, when I had somewhat less projects, but had not released any of them yet.

There are certainly good things about having so many projects: I don’t think I’m ever going to get bored. I have many ideas and wish there was enough time in the world to work on 30 more projects. And even if I wouldn’t think of any more new ideas, whenever I get bored with one of my current projects, I can switch to another one and so on.

Ziggy Returns, Rewritten in Scala

October 2, 2008 by Erkki Lindpere

For about three years already I’ve been working on and off on a server/bot that runs Interactive Fiction games on web forums, effectively turning the single-player text adventure games into cooperative. The beta version launched at Idle Thumbs more than a year ago, but unfortunately it had some problems that made it crash regularly, and I didn’t find the time to fix them.

We’ll, a couple of weeks ago I decided to take the time and rewrote the main server code in Scala. That took only about a week and a half, the bot is now live again and running Hitchhiker’s Guide to the Galaxy. There are still several Java libraries in use of course: Z-Machine from Zinc, Bulletin Board API and ECF, Velocity, HTTPClient etc. But the main server code is now written in Scala.

My main goal for this rewrite, besides switching to Scala, was to simplify the architecture (back to the roots, I guess): the previous architecture was becoming too enterprisey for such a small project. It had too many layers of abstraction, some multi-threading issues made the code hard to debug, and using an OSGi runtime proved to be not that useful in my context. I still think OSGi is great, but sometimes simplicity is even better :)

Thankfully, ECF still works outside of OSGi and only requires two libraries from Equinox. By dropping OSGi, I could simplify the build process (or at least move it to what I’m more comfortable with – Maven). On the server I’m simply launching a Scala object with a main method instead of an OSGi runtime and that is good enough for this project.

The management console application was dropped as well, but I’m exposing some MXBeans on the server so VisualVM or JConsole can be used for management. Web-based management is planned for the future.

Another simplification was dropping some layers of abstraction and removing code that was there only to support hypothetical future features (such as games on IRC and IM, many Interactive Fiction VM implementations etc.). I may be adding some of those layers back in the future, but for now the code should focus on making the core functionality (running a Z-machine game in a vBulletin or phpBB forum thread) as good as it can be.

Perhaps the most improvement that came from this rewrite was that Scala code tends to be about two times shorter than equivalent Java code, as I aslo experienced with my Scala port of Box2D, which I mentioned in a previous post.

But I would say that using Actors for communication between different threads has also gained me some simplicity and I was now better able to understand and fix some of the concurrency issues that used to make the server hang. However, I wasn’t able to move to a completely Actor-based communication model yet, as some of aspects of the messaging between the Z-machine and the forum bot still seemed easier done using other methods, such as blocking queues. Maybe I just don’t know enough about actors yet.

Overall, I’m happy with the result so far and since I find programming in Scala to be more enjoyable than Java, I think I will be more motivated to further develop Ziggy and keep it running smoothly from now on.