Author Topic: rewrote my battle interface  (Read 553 times)

Offline RangerSheck

  • Level 9
  • *
  • Posts: 45
  • Reputation: +3/-0
    • View Profile
    • Aethora, the Browser-Based Tactical RPG
rewrote my battle interface
« on: July 24, 2009, 11:47:21 AM »
Hey all - I recently rewrote the battle interface for Aethora. I wrote an article (first of two parts) describing a little bit of the motivation and process. This first article mainly focuses on performance improvements:

http://rangersheck.com/2009/7/24/rewriting-aethora-s-battle-interface


Offline Harkins

  • Level 28
  • **
  • Posts: 424
  • Reputation: +11/-2
  • Coder, blogger, entrepreneur.
    • View Profile
    • Push CX - Blog
Re: rewrote my battle interface
« Reply #1 on: July 24, 2009, 04:52:57 PM »
You mentioned watching the dev log for oddities... The rails-footnotes plugin is handy for this, it adds a footer to pages (only when developing) with information on queries and renders. I keep an eye on it, when I see 50 queries I'll click for the list, usually there's one repeated over and over... it'll show you the query and, at a click, the traceback that called it or the output of EXPLAIN. The New Relic RPM and FiveRuns Dash gems have similar functions in their gems (which mostly exist to log huge amounts of performance data to their services).

If you're having problems with the performance on simple passthru queries, maybe try Rails Metal or Sinatra to stay in Ruby -- I know I hate switching back and forth between languages.

Great blog post, just wanted to share some resources.

Visit #bbg on irc.freenode.net to talk browser games anytime.

Offline RangerSheck

  • Level 9
  • *
  • Posts: 45
  • Reputation: +3/-0
    • View Profile
    • Aethora, the Browser-Based Tactical RPG
Re: rewrote my battle interface
« Reply #2 on: July 24, 2009, 06:19:29 PM »
Thanks Harkins - been meaning to try out the new relic gem, but that rails-footnotes plugin looks pretty cool. I think someone in my local Ruby group mentioned it at a meeting and I forgot all about it.

I actually did try sinatra via metal prior to going the PHP route. What I found was that I was either continuing to use ActiveRecord, which ended up killing some of the speed benefit, or I was trying to get it to do direct SQL queries, which is actually kind of a PITA when you're not just using AR. Also, all the metal tutorials and examples out there are useless :P  Since I only need to make two or three queries in each call, I took a stab at it in PHP, and it worked out for me.

I should probably make note that although the PHP did actually perform faster on those small scripts, I wouldn't normally condone that behavior from the beginning. Pre-mature optimization is definitely evil. At this point, my combat code is pretty stable (2+ years in the wild) and not likely to change drastically on the front end any time soon.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal