DISQUS

Building Browsergames: Getting Started With A Templating System (Ruby on Rails)

  • Flibbertigib · 1 year ago
    Most of your article seems to have dissapeared, or fallen of the tubes or something.
  • John · 1 year ago
    Not really. The minimal amount of code added to the controller and the view there was enough to get the user object and pull out the login name.

    If you were confused by my comment that "we've seen that the templating code (in the .html.erb files) gives us the ability to include partial pages to reuse sections of HTML, pull data from variables...". That statement is true only across all of the Ruby on Rails entries I've written so far. I showed only the conditional showing and not showing parts of the page and pulling data from a variable. If you want to see the first time I used a partial you can see that in The Login Page (Ruby on Rails) Part 2 (http://buildingbrowsergames.com/2008/08/25/the-...).
  • Juegos Gratis · 10 months ago
    Very interesting. Thanks!
  • play online games · 10 months ago
    I don't really like template system becasuse it's an overhead on your server. More than that, scripting languages like php and ruby have been designed to be simple so I'm not attracted by those templating system. I'm keen on implementing mvc like zend or cakephp but thanks for the tutorial :)
  • Luke · 10 months ago
    A lot of the templating systems available now actually pre-compile your
    templates the first time they get used - so while there is some overhead,
    that overhead is negligible after the first hit on your template - if your
    server is fast enough, the overhead from that initial hit should be barely
    noticeable.
    In my experience, programming languages are typically designed the way they
    are to increase developer productivity - Templating systems are just another
    addition to your toolbelt to increase that productivity - they aren't a
    silver bullet of any kind.

    Also, I would be wary of optimizing a little too early - your statement that
    "it's an overhead on your server" sounds like you may be prematurely jumping
    to the conclusion that your templating system is what is slowing your game
    down. As you can see by looking at the benchmarks at
    http://shootout.alioth.debian.org/u64/benchmark..., Ruby
    and PHP aren't what you should be using at all if you're concerned about
    performance(at least not on a 64-bit Ubuntu machine, anyway) - if you wanted
    your game to be as absolutely fast as possible on the cheapest hardware,
    you'd write it in C++.

    At the end of the day, it's your game. If you'd rather not use a templating
    system, then don't! Maintaining your code is only your responsibility, and
    you(or your team) will be the only ones who see it(or even worry about it,
    chances are). So do what you like - but know that templates come highly
    recommended.
  • amoncarter · 9 months ago
    stumbled on this thread while looking for an education on templating systems.

    would you be able to suggest a few references of systems that you indicate come highly recommended or that pre-compile. my app is not game oriented - just a case where different websites all hosted on the same server will all use a lot of the underlying code but appear and feel different.

    I have been to the smarty website but there seems to be a lot of debate on whether that's overkill.