Problems with samples

Discussion
2005-12-21
2013-04-09
  • I'm scared of libraries so the first thing I do with a new library is try out the samples.  Here is a laundry list of problems I encountered.

    - Many of the scripts seem to have no framerate control, and run at hundreds of frames per second on my PC.

    - play_music.rb does nothing when run.  I have determined that this is caused by improper line endings in the script.  Notice all the "\r"s that should be "\n" or "\r\n".  (the same problem is found in opengl.rbw)

    "require 'RUDL'; include RUDL; include Constant\r\r\n=begin\r\n@file samples\r\n@class Play Music\r\nThis sample plays a bit of music.\r\n=end\r\n\r\ngets\r\n\r# Set the mixer to some nice values. If we skip this, it starts itself up when\r# it is needed and chooses some default values then.\r# Odd: the \"mixer\" variable is not needed, every method on it is also available on\r# class Mixer itself.\rmixer=Mixer.new(44100, AUDIO_S16SYS, 2, 16384)\r\r# Load a music file and play it. Simple huh?\r# Odd: when you say \"happysong.stop\", it doesn't actually stop happysong. It always\r# stops the song that is currently playing. Some other methods do this too.\rmusic=Music.new('media/crapola_ha_ha_thump.mod')\rmusic.play\r\r\nputs 'Just an example that plays some music'\r\rgets"

    - opengl.rbw manages to push most of the other windows on my desktop rightward onto my second monitor, including maximized windows (which are not pushed all the way and float in a maximized state somewhat between them.)  This occurs on startup and the windows stay that way when you quit.

    - Error in sdl_ball.rb (apparently before showing the first frame):
    sdl_ball.rb:126:in `flip': DirectDrawSurface3::Flip: DirectDraw is still drawing
    (SDLError)
            from sdl_ball.rb:126:in `main'
            from sdl_ball.rb:130

    - In edit_field_test.rbw, the line "editfield.draw display" doesn't work.  The exception is
    rudl-0.8-for-ruby-1.8.2-setup-releasebuild/utility/edit_field.rb:145: `no implicit conversion from nil to integer' (TypeError)
        from ../utility/edit_field.rb:145:in `draw'
        from C:/Download/rudl-0.8-for-ruby-1.8.2-setup-releasebuild/samples/edit_field_test.rbw:39

    - It took me awhile to figure out the purpose of string_loading.rbw.  Maybe the comment inside should say what it's all about?  For that matter, all the samples could use a little of that.

    - urlaubtris.rb apparently ignores its own configuration file (using defaults on startup.)  Also, sometimes (it's inconsistent... maybe a race condition?) blocks come down at double speed if you pressed "down" to bring down the previous block.

    - play_music.rb has this comment.  I guess it's a bug--is it fixed?
    # Odd: when you say "happysong.stop", it doesn't actually stop happysong. It always
    # stops the song that is currently playing. Some other methods do this too.

     
    • um, I can't believe how bad SF.net forums are.  Of course, (ampersand)quot; is supposed to be a quotation mark and (ampersand)amp; is supposed to be an ampersand, etc.

       
    • Please ignore this post, I'm just testing to see if SF can be prevented from screwing up the posts.

      <PRE> & > " < " </PRE>
      &amp; &gt; &lt; &quot;

       
    • Renne Nissinen
      Renne Nissinen
      2005-12-23

      - Agreed, the samples are in various states of rot and decay. They need fixing up in several ways :)

      - You're right about the broken line endings in those files. A strange phenomenon.

      - I didn't get that "DirectDraw is still drawing" error with sdl_ball.rb, and it's the first time I've heard of such an error. What OS do you have?

      - I get the same error with edit_field_test.rbw. After investigating I found the error is in utility/edit_field.rb, specifically in the constructors of the subclasses of EditField. I am baffled, since I remember trying out all the samples before releasing RUDL 0.8, and they worked :)

      - Urlaubtris is a contributed sample, so it comes "as is" ;) Anyway, it's not meant to be a great game or an example of good RUDL style (it doesn't quit from the close button), it's just there as a demo and code example.

      - As for play_music.rb... I experimented with sounds in RUDL sometime, and found the current system to be very limited. We need to switch to a better audio SDL component, if there are any :)

       
      • Peter Thoman
        Peter Thoman
        2006-02-03

        "- Urlaubtris is a contributed sample, so it comes "as is" ;) Anyway, it's not meant to be a great game or an example of good RUDL style (it doesn't quit from the close button), it's just there as a demo and code example."

        Hey! I take grave offense at that :D
        But seriously, that's exactly right. The config file stuff was bolted on near the end (if you can talk about an "end" in a what was basically a 1 weekend project) but still, it shouldn't just ignore it. On the positive side, the code is quite short so it should be easy to fix ;)

         
    • Renne Nissinen
      Renne Nissinen
      2005-12-23

      Oh yeah, about that opengl.rbw moving windows - I can't test it since I don't have a dual monitor setup, but it definitely sounds like an SDL problem.