Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Nokogiri xpath suitable every frame
- - By chase4926 Date 2013-08-30 15:40
So I'm making a Pirate RPG game called Vortex Voyager (github.com/chase4926/VortexVoyager) and one of our project goals is to be very moddable. So for our main menu, we're using an xml file to "style" it, and in doing so, are making xpath calls every frame.

Is this reasonable?
When myself and the other person on the team run it, we get a smooth 60, but is this going to be a serious problem when we get into things other than the main menu?

Also I should note:
I have a specific need for Nokogiri due to it's searching ability, which prevents me from using something a little more efficient like xml-simple (which simply converts an XML file into a hash).
Parent - By shawn42 Date 2013-08-31 21:13
I'm not quite sure I understand how you're using nokogiri every frame, but I would recommend using yaml (xml is so heavy and nasty to work with). You should be able to load/parse your configs (xml or yaml) only once, store what you need and build your menus from that. After that you wouldn't need to parse any xml/yaml again. An example of using yaml to style GUIs can be found at my discontinued Rubygoo project here: https://github.com/shawn42/rubygoo/blob/master/themes/default/config.yml

hope that helps,
Parent - - By jlnr (dev) Date 2013-09-01 10:23 Edited 2013-09-02 07:13
Well, you can always benchmark it and see how much time you're consuming. As long as even old machines can stay under 16ms for a frame, you're fine :)

But I have to second the suggestion to use something like YAML which maps very naturally to Ruby, where you can then use standard Enumerable methods to perform your lookup logic.
Parent - By chase4926 Date 2013-09-02 01:41
Just spend about an hour converting it all to YAML.

Enumerable::select is what I needed, didn't use it before today.
Parent - - By ml Date 2013-09-28 19:18
Hey I just cloned VortexVoyager and tried running it. I executed "ruby main.rb" from the /src folder, and I got the following error:

/VortexVoyager/src/engine.rb:7:in initialize': uninitialized constant ControllerObject::Queue (NameError)
  from /VortexVoyager/src/menu.rb:7:in
initialize'
  from /VortexVoyager/src/engine.rb:32:in new'
  from /VortexVoyager/src/engine.rb:32:in
initialize'
  from /VortexVoyager/src/engine.rb:162:in new'
  from /VortexVoyager/src/engine.rb:162:in
initialize'
  from main.rb:42:in new'
  from main.rb:42:in
<main>'

Any suggestions?... I'm just interested in getting a peek at the project.
Parent - By chase4926 Date 2013-09-28 19:37
My friend also had this issue, no idea what's causing it but there's an easy solution:

require 'thread'
Parent - - By chase4926 Date 2013-09-28 19:38
Also on the title screen, the konami code followed by enter may or may not activate an easter egg.
Parent - By ml Date 2013-09-29 19:21
Hey thanks, I'll give it another whirl.
Parent - - By ml Date 2013-09-29 21:26 Edited 2013-09-29 21:33
Wow, "require 'thread'" took care of everything! I love it when things work! Looks like the project is coming along nicely, with a solid, robust core. I won't provide any unsolicited feedback as this is clearly at the early development stage - except to say thanks for sharing - I will be able to learn a lot from studying this code, especially as the game moves further along. I scrolled around and looked at the world a bit.

I'm still trying to figure out what "the konami code" is.... I guess I'll have to dig around in the source for it...

If you are interested in having another contributor, sign me up! I'm pretty (very) novice at programming, but I can certainly take orders and help with creating graphics and animations and those kinds of things.

Thanks again for sharing!
Parent - - By chase4926 Date 2013-09-29 21:37
Work is suspended as of a few weeks ago, I'll most likely continue work sometime soon though.

Also: http://en.wikipedia.org/wiki/Konami_Code
Parent - By ml Date 2013-10-03 03:12
Just tried it out - the Easter Egg is AWESOME!

And here I always thought that was the "Contra Code"...
Up Topic Gosu / Gosu Exchange / Nokogiri xpath suitable every frame

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill