Author Topic: Loading Screen  (Read 2555 times)

0 Members and 1 Guest are viewing this topic.
ngoaho Male
**
Rep: +1/-2
Offline Offline
Level 52 (35%)
Real-time RPG is great
Loading Screen
« on: January 20, 2010, 10:15:33 PM »

  • a script that give a loading screen when transition start
    give credit if use
    Code: [Select]
    #==============================================================================
    # Now Loading
    # a script that give a loading screen when transition start
    # writen by: ngoa ho
    # http://www.ngoaho.net- ngoaho91@yahoo.com.vn
    #==============================================================================
    module NowLoading
      module_function
      def start(text="§ang t¶i...")
        @start = Thread.new do
          bitmap = Bitmap.new(640,50)
          bitmap.font.size = 15
          bitmap.fill_rect(0,0,640,50,$colorlib.black(150))
          bitmap.draw_text(0,0,640,50,text,1)
          @loading_spr = Sprite.new
          @loading_spr.bitmap = bitmap
          @loading_spr.y = 205
          @loading_spr.z = 9999
          loop do
            sleep(0.001)
            Graphics.update
          end
        end
      end
      def stop
        @start.exit unless @start.nil?
        @loading_spr.dispose unless @loading_spr.nil?
      end
    end
    # use:
    # def initialize(*args)
    #   NowLoading::start([intro text])
    # end
    # def load_ok
    #   NowLoading::stop
    # end
    « Last Edit: January 20, 2010, 10:17:56 PM by ngoaho »
    need a team mate for dev game in rgss.
    y!m: ngoaho91
    gtalk: ngoaho91
    game dev resource: http://www.mediafire.com/ngoaho
    ngocthang26
    *
    Rep: +0/-1
    Offline Offline
    Level 52 (11%)
    Re: Loading Screen
    « Reply #1 on: January 21, 2010, 10:14:04 AM »

  • I do not think will meet ngoaho
    ngoaho Male
    **
    Rep: +1/-2
    Offline Offline
    Level 52 (35%)
    Real-time RPG is great
    Re: Loading Screen
    « Reply #2 on: January 22, 2010, 12:36:11 PM »

  • ah, hi ngocthang26, nice to meet you at here
    need a team mate for dev game in rgss.
    y!m: ngoaho91
    gtalk: ngoaho91
    game dev resource: http://www.mediafire.com/ngoaho
    ngocthang26
    *
    Rep: +0/-1
    Offline Offline
    Level 52 (11%)
    Re: Loading Screen
    « Reply #3 on: January 25, 2010, 07:13:31 PM »

  • me too
    Zylos Male
    *
    Furry Philosopher
    Rep: +242/-133
    Offline Offline
    Level 74 (20%)
    Checkmate.
    Re: Loading Screen
    « Reply #4 on: January 25, 2010, 08:35:59 PM »

  • What kind of loading screen is this? Can we get a screenshot?
    grafikal Male
    *****
    Resource Artist
    Rep: +164/-112
    Offline Offline
    Level 74 (76%)
    I really want those fucking flippers.
    Re: Loading Screen
    « Reply #5 on: January 25, 2010, 08:38:55 PM »

  • Zylos, first you have to say something in gibberish and then translate into their language :)

    ngoaho Male
    **
    Rep: +1/-2
    Offline Offline
    Level 52 (35%)
    Real-time RPG is great
    Re: Loading Screen
    « Reply #6 on: January 26, 2010, 10:55:22 PM »

  • in script

    loading, you can change loading text each time you load.

    load ok, new scene
    need a team mate for dev game in rgss.
    y!m: ngoaho91
    gtalk: ngoaho91
    game dev resource: http://www.mediafire.com/ngoaho
    stripe103 Male
    ***
    Rep: +3/-5
    Offline Offline
    Level 58 (68%)
    It's human to misdo
    Re: Loading Screen
    « Reply #7 on: January 30, 2010, 02:20:23 PM »

  • I've tried several times. I put it in the Scene_Title so it would show that it loads when it starts. The only problem is that when it comes to the line: NowLoading::start("Loading...") the game just exits. Please help me. I would really like this script.
    stripe103 Male
    ***
    Rep: +3/-5
    Offline Offline
    Level 58 (68%)
    It's human to misdo
    Re: Loading Screen
    « Reply #8 on: February 27, 2010, 01:36:52 PM »

  • BIG BUMP
    Zeriab
    *
    ? ? ? ? ? ? ? ? ? The nice kind of alien~
    Rep: +154/-10
    Offline Offline
    Level 74 (01%)
    Martian - Occasionally kind
    Re: Loading Screen
    « Reply #9 on: February 28, 2010, 08:37:02 AM »

  • Hi ngoaho ^_^

    It's nice seeing an actual loading script and not one of the fake loading screen which does nothing for a while.
    Am I correct in assuming that $colorlib.black(150) is Color.new(0,0,0,150)?
    Either way I suggest that you replace $colorlib.black(150) with the corresponding color since $colorlib is nil in the default scripts.

    I suggest that you send a signal to the thread which then takes care of shutting down properly.
    Here is a modification of the script showing you what I mean:
    Code: [Select]
    #==============================================================================
    # Now Loading
    # a script that give a loading screen when transition start
    # writen by: ngoa ho
    # http://www.ngoaho.net- ngoaho91@yahoo.com.vn
    #==============================================================================
    module NowLoading
      module_function
      def start(text="§ang t¶i...")
        @start = Thread.new do
          # Create sprite
          bitmap = Bitmap.new(640,50)
          bitmap.font.size = 15
          bitmap.fill_rect(0,0,640,50,Color.new(0,0,0,150))
          bitmap.draw_text(0,0,640,50,text,1)
          @loading_spr = Sprite.new
          @loading_spr.bitmap = bitmap
          @loading_spr.y = 205
          @loading_spr.z = 9999
          # Wait
          loop do
            Graphics.update
            sleep(1)
            # Stop waiting if the loading is done
            break if Thread.current[:done] == true
          end
          # Clean up
          @loading_spr.dispose
        end
      end
      def stop
        if !@start.nil? && @start.alive?
          # Tell the thread that it should stop
          @start[:done] = true
          # Wakes the thread so we don't have to wait for the sleep
          @start.wakeup
          # Wait for the thread to finish
          @start.join
        end
      end
    end

    Notice that I have changed sleep(0.001) to sleep(1). Since it has no animation there is no reason to call Graphics.update so often.
    All threads pause when Graphics.update is called. So the fewer calls the better.

    I suggest making it animated:
    1. Loading
    2. Loading.
    3. Loading..
    4. Loading...
    1. Loading

    It will give people a feeling of something happening.
    Perhaps a sleep(0.4) will feel better for the animation. Maybe more, maybe less.


    You should note that creating sprites in the main thread while the loading thread is running is dangerous due to potential race conditions. I.e. Sprite creation is not thread-safe.

    @stripe103:
    Do you really need this script?
    I tried using the script for loading the database in the default scripts. The loading bar flashed and was gone.
    Remember that this is an actual loading script. It involves multithreading and thus should only be used if you have a real need for it.
    If you just want to fake it I suggest using one of the many of them out there.

    *hugs*
     - Zeriab
    garygill <3
    stripe103 Male
    ***
    Rep: +3/-5
    Offline Offline
    Level 58 (68%)
    It's human to misdo
    Re: Loading Screen
    « Reply #10 on: February 28, 2010, 01:41:57 PM »

  • No I don't want to fake anything, but it is good to have because me and a couple of friends are going to make a quite big game(hopefully)
    Taylor Male
    ***
    Rep: +3/-1
    Offline Offline
    Level 68 (65%)
    can't work on one project at a time
    Re: Loading Screen
    « Reply #11 on: March 13, 2010, 09:16:30 PM »

  • Is this really a loading screen though? All I can make of it is a script that turns on or off a string a transparent rectangle.
    You have to control when the text should appear and disappear. While I have figured out how to show what is being loaded (by adding multiple calls to the database loading in Scene_Title), shouldn't a real loading screen detect if data is being loaded and automatically activate itself?
    ಠ_ಠ
    grafikal Male
    *****
    Resource Artist
    Rep: +164/-112
    Offline Offline
    Level 74 (76%)
    I really want those fucking flippers.
    Re: Loading Screen
    « Reply #12 on: March 13, 2010, 10:02:55 PM »

  • it doesn't load anything, it's aesthetic which isn't really aesthetic because no one likes loading screens unless you need them.

    Zeriab
    *
    ? ? ? ? ? ? ? ? ? The nice kind of alien~
    Rep: +154/-10
    Offline Offline
    Level 74 (01%)
    Martian - Occasionally kind
    Re: Loading Screen
    « Reply #13 on: March 14, 2010, 09:00:44 AM »

  • You guys obviously don't understand the concept of threads.
    Even so I believed that you didn't need to know how to use threads to use this loading screen.
    You just need to know that you have to be careful about creating sprites and windows in the main thread.
    I am surprised though as I thought the post with the big picture explained how to use it very well.
    I am disappointed in you guys. ;9

    @stripe: I dunno why it simple exits the game. It sound very strange. Unless you don't do anything afterwards.

    *hugs*
    garygill <3
    Taylor Male
    ***
    Rep: +3/-1
    Offline Offline
    Level 68 (65%)
    can't work on one project at a time
    Re: Loading Screen
    « Reply #14 on: March 19, 2010, 03:29:02 AM »

  • Nope, I don't understand them. XD; I can see there's something different about this code though.

    I just assumed though it would start and close itself before the title. *shrug* No matter, this might be useful for my VX project because sometimes it takes up to 15 seconds to load. D:
    ಠ_ಠ
    ngoaho Male
    **
    Rep: +1/-2
    Offline Offline
    Level 52 (35%)
    Real-time RPG is great
    Re: Loading Screen
    « Reply #15 on: April 02, 2010, 09:07:21 AM »

  • long time no visit, thank you zeriab, i forget it.
    p/s: i'm looking for a rgss editor, anyone have.
    « Last Edit: April 02, 2010, 09:17:10 AM by ngoaho »
    need a team mate for dev game in rgss.
    y!m: ngoaho91
    gtalk: ngoaho91
    game dev resource: http://www.mediafire.com/ngoaho
    max2000
    *
    Rep: +0/-0
    Offline Offline
    Level 50 (39%)
    Re: Loading Screen
    « Reply #16 on: April 23, 2010, 08:00:41 AM »

  • hi all
    it seems i don't know to use this script  :P
    i where do i put it (ex:Scene_Menu-Scene_Title) or do i use a new page of script ? :-\
     :lol:
    ngoaho Male
    **
    Rep: +1/-2
    Offline Offline
    Level 52 (35%)
    Real-time RPG is great
    Re: Loading Screen
    « Reply #17 on: May 12, 2010, 09:57:45 PM »

  • hi max2000, put it in a new script page.
    follow http://rmrk.net/index.php/topic,37177.msg438509.html#msg438509 to insert a loading screen.
    need a team mate for dev game in rgss.
    y!m: ngoaho91
    gtalk: ngoaho91
    game dev resource: http://www.mediafire.com/ngoaho
     

    hi

    RMRK.net Theme Super Ultra Mega Beta

    Follow RMRK on Twitter Ask RMRK Questions on Formspring Get RMRK Updates via Windows Live

    Page created in 0.285 seconds with 19 queries.