Posts arquivos para novembro, 2008

28nov2008

JettyRails 0.7, Merb 1.0 support

(0) comentários

After the 1.0 official release, Merb is gaining more and more attention.

I’ve updated JettyRails to support Merb 1.0 applications, making it a good choice to run your rails and merb applications with JRuby, particularly in development time.

The release notes include:

* Merb 1.0 support!
* jruby-rack updated to the latest release (0.9.3)
* jetty server update to 6.1.14
* JSP and JSP Expression Language support
* some minor bugs

It is very simple to run any Merb 1.0.x and Rails 2.x applications. You just need to have JRuby properly installed, but JettyRails doesn’t work with jruby-1.1.4 (JRUBY-2959). First step is to install jetty-rails:

jruby -S gem install jetty-rails

Then, for Rails applications:

cd myrailsapp
jruby -S jetty_rails

And for Merb applications:

cd mymerbapp
jruby -S jetty_merb

Please note that you can’t use Merb with DataMapper in JRuby right now, but ActiveRecord does the job. Work is being done by Yehuda Katz (wycats) and Nick Sieger to port the native parts of DataObjects (used by DataMapper) in the do_jdbc project. Because of that, you can’t just install the merb gem. Wanted Merb modules should be installed separately:

jruby -S gem install merb-core # required
jruby -S gem install merb-more # extras


Posted in java, jetty, jruby, merb, rails Tagged: jetty, jetty-rails, jruby, merb, rails, release
22nov2008

Play with JMaglev yourself

(0) comentários

JMaglev is finally public available!

I’m releasing my experiments with JRuby and Terracotta, so you can play with JMaglev and contribute some code. The project is in Github.

I had to patch JRuby to make RubyObjects a little less dependent from the JRuby Runtime. It isn’t perfect yet, but is working. The patch against the current jruby trunk (rev. 8091) and the patched jruby-complete are included in the project.

The code in Github is just a TIM (Terracotta Integration Module) with a sample maven project and the JMaglev use-case included. Unfortunately, I haven’t any time yet to upload the TIM to Terracotta Forge. BTW, does anyone know how to do this?

For those who want to reproduce my JMaglev demo, here is a step-by-step. You must have GIT, Maven 2 and the JDK properly installed. It only works on Linux and OS X. Is anyone wanting to contribute support for Windows users?

  1. git clone git://github.com/fabiokung/clustered-jruby.git
  2. long time waiting, because terracotta-2.7.1 (vanilla) and jruby-complete (patched) are bundled.
  3. cd clustered-jruby
  4. mvn install (although mvn package is enough)
  5. cd jmaglev
  6. start the terracotta server:
    lib/terracotta-2.7.1/bin/start-tc-server.sh
  7. open another two terminals
  8. run the simplified jirb inside them:
  9. cd clustered-jruby/jmaglev
    ./bin/jmaglev jmaglev.rb

  10. Follow the demo. You will be able to share global variables among all jmaglevs:
    require 'hat'
    $hat
    require 'rabbit'
    $hat.put(Rabbit.new)
    
  11. in the other terminal, try to see the magic hat contents:
    $hat
    

I haven’t tested it with rails applications, but right now, it isn’t able to run IRB. I never thought that running IRB could be so hard. :-)

More drawbacks and limitations are being discussed in the JRuby Users Mailing List.

I hope to see many contributions. Happy hacking!


Posted in cluster, java, jruby, maglev, ruby, terracotta Tagged: cluster, github, jmaglev, jruby, maglev, opensource, terracotta
3nov2008

TGWOH² 2008-11-03 23:28:00

(0) comentários
Reflections Roundup Series nº 1:

The C++ Winter, Game Development Environments and Programming Languages


Meta: Reflection Roundup series are ramblings in one or multiple related subjects where i try to expose my point of view (YMMV of course, so comment!)

Before starting this post, remember that the language i’m talking about is C++(not ANSI C or Objective-C).

My relationship with C++ can be described as a 3-instance date that ended with me putting it up in the refrigerator. What always drove my attraction to C++ is the fact that it’s intensively used in the game development world…. being the gamedev wannabe that i am, i said “I must learn it at any cost!” and started reading and gathering information in order to understand the language’s mechanisms and their rationale.

When i got committed to a game project a few months ago(that blew up unfortunately) , I’ve gone through Scott Meyer’s Effective C++ [1] to acquire a deeper understanding of the language, its pitfalls and ambiguities.
What I’ve realized after reading half of the book is that you gotta practice defensive programming all the time. In some situations i bet there are more than 5 ways to add undefined behavior to your program in a single expression. That’s a tough thing… because the complexity of the language easily surpass the complexity of the problem being solved and i’m sure that this have a serious impact in productivity.
Spice it up with a large source tree,complex builds, and multi-platform code[2] , roast it intensively with the multicore crisis and you can realize that it’s not a very nice place to be…

I can’t imagine how these guys manage to be productive… and i would really love to spend one day watching the spartan work of a Sr. Programmer of the game industry, so i could bring my opinion closer to reality.
I’m not the best to speak on its problems… there are people that faced them on a daily basis for some time and can clearly discuss on the subject [3]

Some remarkable guys built something different a while ago. Naughty Dog, the softhouse behind famous Playstation 1 and 2 titles like Crash Bandicoot and Jak And Dexter managed to develop their own environment for game development. It consisted of a lisp DSL that allowed fluent rendering description procedures(probably allowing SIMD assembly inline as well) and game entities management. All of this in the top of a REPL that Emacs clients would connect to send code upgrades on the fly!
This genius environment [4] , structured by Andy Gavin (an MIT-brewed-lisp Jedi) had its flaws as well. Even sounding like the wet dream of most game developers it didn’t solved all the problems. With an environment like this ND was swimming against the current, becaus most of the vendor tools were aimed for the C++ market. They had to maintain lots on in-house code, and most of the core stuff was centered in Andy. The result was : When Andy left, there was no further interest to keep improving the technology, so, everything was dropped off in favor of C++[5]. Another potential case of Philip Greenspun’s 10th programming rule.

Even not being the “happily ever after story” it’s a proud example where fearless research and exploration of different technologies can led small companies to Beat the Averages and deliver high quality products. Few people tends to pick change instead of cold comfort.

Tim Sweeney, the architect behind Epic’s Unreal technology already expressed his ideas of a programming language that would be ideal for games and suggested some good stuff that would be of high value for game developers and other kinds of multimedia/real time apps. Some programming idioms in the presentation may remind you of Haskell (list comprehensions) Erlang and the newborn Clojure (concurrency features like Software Transactional Memory and Actor-based concurrency). The use-or-not-use garbage collection may remind you of Digital Mars D, where you can choose between garbage-collection and manual memory management.
Speaking on D, Andrei Alexandrescu exposed recently the new functional mechanisms to be implemented in D. For those who don’t know him , he’s the author of a famous C++ template voodoo book[6] and he’s currently assisting on the design of D. He surely know what pissed him off in C++, and what would he do to improve it.
C++0x is intending to employ functional constructs as well, but the question is how many 8 years will take for compilers to catch up with the new standard.

It’s notable that developing a AAA game is risky business all the way, and the best way to reduce risk is through the use and development of tools that assist in controlling complexity, allowing the developers energy to be better employed in problem solving and design innovations instead of “which side of my declaration the * should go this time?”

Multi-platform game development urgently needs a language/platform to make this happen. I think its past time to appear a massive turnaround in the area (much like Java and Ruby on Rails as internet apps development platform at their respective boooms) The funniest thing is that even games being the type of application responsible for edging technological improvement in the area of PCs and specialized appliances, very little innovation is exposed in terms of programming languages and runtime environments for development and deployment of games… My vision may be distorted , but it looks that stuff is pretty much done the way it was like 15 years ago , but in larger scale.

C++ is still on the run, and there are loads of people using it. It’s kind of a “Double-Edged Gunblade of the programming languages where you can cut your neck and shoot youself in the foot in just one move.
It’s a complex and potentially great tool in the hands of a programmer that features a full C++ runtime embedded in his brain.

Me? I prefer to keep ANSI-C, Objective-C, Ruby and Lisp in my weapon box , and you?


References:

[1] Meyers, Scott(2005) Effective C++, 55 specific ways to improve your programs and designs

[2] A pal from Australia that works in the game industry once told me that their C++ game codebase was tweaked to compile/run in more than 3 platforms… imagine the entanglement of #ifdefs and other preprocessor code bending to make it happen

[3] The C++ FQA is a good digest of most common CPP pitfalls. For a more more “first-person-narrative-style ” this guy exposes his pain , and how he gave up on C++ and decided to code in a Object Oriented C Idiom.

[4] Gamasutra has one of the few articles around describing how the DSL and the development environment was

[5] A while ago Naughty Dog announced their return to Lisp in their game development platform, using their experience from GOAL to improve their environments. Way to GOAL! :D

[6] Alexandrescu, Andrei(2001) – Modern C++ Design: Generic Programming and Design Patterns applied

Switch to our mobile site