Saturday, July 16, 2011

More Concise and More Powerful

Over a year ago I posted about the focus of Sgine to be extremely concise in creating 3d applications. I've always found it annoying that the barrier to entry writing 3d applications of any sort if overly complicated. I started Sgine with the belief that an engine could be created that abstracts without reducing the power of the system. Scala has been instrumental in making this possible.

Now, the point of this post is to announce that I'm finally back to the UI abstraction layer again. After nearly a year of re-architecting and adding new foundational concepts I'm finally back to the high-level abstraction that is the magic of Sgine.

In the post I mentioned above I was showing off just how concisely you can display an image in Sgine:

package org.sgine.ui

import org.sgine.core.Resource

import org.sgine.render.StandardDisplay

object TestImage extends StandardDisplay {
 def setup() = {
  val component = new Image(Resource("puppies.jpg"))
  scene += component
 }
}

My goal in this re-write was to keep at least as concise as 0.1 and hopefully achieve something even better. I do believe I have accomplished something even more concise in the current iteration of development with only a single line of logic to display an image on the screen:

package org.sgine.ui

object ImageTest extends UI {
  this += Image("sgine.png")
}

There may be some slight revisions to this (ex. I'm considering extracting the base container out into a variable name "container" instead of mixing it into UI), but I honestly don't see any way I can make it any more concise than that. :)

For those of you that love pictures, here's the screenshot of what's displayed:



There hasn't been a lot of chatter on here lately, but now that I'm back on the UI abstraction layer there will be a lot more to see, so check back often.

2 comments:

  1. Hi Matt,

    Thanks for considering those of you that love pictures :)

    One of the things I like about Scala is the ability to gradually scale from a small script/prototype to a full sized application.

    With my very limited game engine experience, I found that often you would start extending "SampleApplication" or something. Later on in the project it would still functionally fit your application 90%, but you have to rewrite your base class for that 10% that doesn't fit (function/performance).

    Have you got a rough idea at this point how your concepts might be better/worse in this area?

    ReplyDelete
  2. @Eelco, this was a big frustration for me when I was developing on the jME team. That's why I created StandardGame to support not just "sample" or "simple" applications, but all applications. My goal is similar in Sgine. If you need more advanced functionality you should still be able to use the UI class to achieve it, you just may need to mix-in additional functionality or write additional configuration. Just because something is powerful does not mean it has to be overly complicated. Nor does it mean that you have to write a bunch of boiler-plate in order to do something simple.

    If you are familiar with the jME project, the ideas I created for StandardGame are still extremely popular today with it.

    ReplyDelete

Scala Engine for high-performance interactive applications.