Falling blocks game in Plymouth

So, you have sat down at your computer and you’re waiting for it to boot, then suddenly you realise that it is doing a full fsck which is going to take a few minutes. What to do. You have two options:

  1. Sit quietly watching the little bar move slowly across
  2. Plymouth falling blocks game!

This is not a serious proposal, I just wanted to exercise the scripting system to see if I could find any bugs, but if you want to have a play with it, the script is available.

    • Ray
    • April 3rd, 2010

    Very Neat. Kind of reminds me of the old caldera installer

  1. Indeed, a neat demonstration of Plymouth power, which however I hope to never got to use ;p

    And just as Ray, I remember installing once Caldera many years ago and playing the game during the wait.

    Now how about some 3D shooter plymouth plugin? (like the canvas demo for Firefox)

  2. Ha ha, yet more proof of the power F/OSS brings. There’s only one problem with this script: Linux normally boots way too fast. On a recent machine you’d play for, what, 20-30 seconds at most?

    • kar
    • April 29th, 2010

    Which licence? GPL?

    • Sure if you like. For these scripts, I didn’t even put a licence as people will want to use them as a basis of their own scripts which they may want to be licensed differently. So public domain if it exists in your country.

    • Piero
    • June 19th, 2010

    Hi,
    thank you very much for these instructions.
    I am quite new to ubuntu, but I dared to try to create my simple splash image in order to use it in the boot sequence. I wanted to test it using your X11 plugin method. Believe it or not I was able to compile everything (after installing I don’t know how many packages). Now, if I issue the command
    plymouth –show-splash
    I get the prompt again and I do not see any splash image. plymouth runs fine. In addition, before this attempt I was able to change the theme to solar and it was working beautifully. Now I get the ubuntu text, even if it seems to me solar is set correctly. I am very puzzled. Maybe you can help me? Thank you very much,
    Piero

    • Problem is that in Ubuntu, the files are installed in different places. I don’t know what configure line they use. Actually, you can now just install the plymouth-x11 package to get the x11 renderer so there is no longer need to compile your own version. I recommend you reinstall the provided packages ( think there is an apt-get reinstall command).

    • Piero
    • June 21st, 2010

    Thank you very much! I re-installed any package with “plymouth” in its description using synaptic and I am back with my nice solar theme running during the boot process. I checked and indeed also the plymouth X11 renderer is installed, but here is what I get:

    piero@MultimediaPC-1:~$ sudo plymouthd
    [sudo] password for piero:
    piero@MultimediaPC-1:~$ sudo plymouth-set-default-theme solar
    piero@MultimediaPC-1:~$ plymouth –show-splash
    piero@MultimediaPC-1:~$

    and nothing happens. Am I doing something wrong?
    Thanks a lot

  3. The plymouth –show-splash also needs to be done as root. Also, you only need to run plymouth-set-default-theme once when changing the splash, but that must be before the plymouthd starts.
    After youre finished, run sudo plymouth –quit.

    • Piero
    • June 21st, 2010

    I got it to work!!
    Thank you so very much. Now I can start playing with it.

    • Piero
    • June 21st, 2010

    I was too quick…
    Now I get this:

    piero@MultimediaPC-1:~$ plymouth-set-default-theme spinfinity
    This program must be run as root

    If I run it as sudo, it goes fine but then when I issue
    sudo plymouth –show-splash

    I still get the solar theme…
    Sorry to bother you.
    thank you

  4. Yeah, Ubuntu use a non standard way of selecting the themes, Search Google for “update-alternatives plymouth” and there are a couple guides how to do this.

    • Piero
    • June 22nd, 2010

    Great! I am now finally able to change and test the theme! Non-standard is the delight and pain of Linux…I hope your guide about creating themes works for ubuntu now. I will report back, if you like.
    You’ve been really kind and patient,
    thank you

    • Piero
    • June 27th, 2010

    I made many attempts and I cannot get my own splash image to work. I noticed that some other people cannot get it to work on ubuntu:

    http://www.ubunturoot.com/2010/05/how-to-create-simple-plymouth-theme.html

    Maybe it is something with he ubuntu implementation…

  5. Hi there,

    Thanks heaps for all the code samples – here is mine – direct rip from you with a few mods to include the vizta opacity trick, with the butterfly flying around it. I’m no programmer but hey it works :)

    Can you help me with the speed of the specs appearing? I have managed to speed up the logo, and butterfly – but the specs are barely even on the screen before my login prompt appears. The splash is only on my screen for about 5 seconds (8 if do fsck) (total boot up is 10 to 15 seconds). So can I set the speed of the whole block perhaps to a fix time or can I change something with the specs so they are appearing and go from 0 to 1 opacity faster?

    #—————- CODE ————————–
    for (i=0; i<10; i++){
    spec[i].image = Image("spec" + (i % 3) + ".png");
    spec[i].sprite = Sprite(spec[i].image);
    spec[i].sprite.SetOpacity (0.0);
    }

    for (i=0; i<4; i++){
    butterfly_images[i] = Image("butterfly" + i + ".png");
    butterfly_sprite = Sprite(butterfly_images[i]);
    }

    logo.image = Image("PH.png");
    logo.sprite = Sprite(logo.image);
    logo.sprite.SetX (Window.GetWidth() / 2 – logo.image.GetWidth() / 2);
    logo.sprite.SetY (Window.GetHeight() / 2 – logo.image.GetHeight() / 2);
    logo.sprite.SetOpacity (0.0);
    logo.sprite.SetZ (10000);
    progress = 0.0;
    progress_butterfly = 0;

    fun refresh_PH (){
    inc = progress;

    {
    progress_butterfly++;
    theta = progress_butterfly / 30;
    butterfly_sprite.SetX(Window.GetWidth() / 2 + Math.Sin(theta) * 200);
    butterfly_sprite.SetY(Window.GetHeight() / 2 – Math.Cos(theta) * 200);
    butterfly_sprite.SetImage(butterfly_images[Math.Int(progress_butterfly / 3) % 4].Rotate(theta));
    }

    logo.sprite.SetOpacity (MathClamp((inc-0.2)/0.2, 0, 1));

    if (inc<0.8){
    for (i=0; i<10; i++){
    spec[i].sprite.SetX (Window.GetWidth() / 2 – spec[i].image.GetWidth() / 2 + Math.Sin(i*i+(inc*100+i*17)/10) * (0.8-inc)*Window.GetWidth()*0.3);
    spec[i].sprite.SetY (Window.GetHeight() / 2 – spec[i].image.GetHeight() / 2 + Math.Cos(i*i+(inc*100+i*5)/7) * (0.8-inc)*Window.GetHeight()*0.3);
    spec[i].sprite.SetZ (0);
    spec[i].sprite.SetOpacity (inc/0.8);
    }
    }
    else {
    for (i=0; i<10; i++)
    spec[i].sprite.SetOpacity (Math.Clamp((0.9-inc)/0.1, 0, 1));
    }

    }

    Plymouth.SetRefreshFunction (refresh_PH);

    Thanks heaps in advance :)
    Peter

  6. Piero :
    I noticed that some other people cannot get it to work on ubuntu:
    Maybe it is something with he ubuntu implementation…

    Hey Piero – I have ubuntu lucid 10.04 and I have plymouth working just fine (and thanks to the man here I have it looking pretty sexy as well)

    My boot goes like this
    1. PC BIOS
    2. Ubuntu Menu at 1280x720x32 with nice 24bit image
    3. Enter boot choice and Image STAYS on screen
    4. Flash black screen for 1 second
    5. Plymouth splash loads same Res & 24bit image and:
    a) boot messages scrolling up the left side
    b) Vizta logo image appearing in the middle
    (customised logo from Charlies Vizta theme)
    c) Butterfly flying around the logo
    6. Flash black screen (switch to 1080p) resolution
    7. Login screen with same 24bit image

    My whole boot time is only about 15 seconds so the splash is only on screen for about 5 to 8 seconds. I am waiting to see if Charlie can help me speed up the animation of the specs in the Vizta theme, but apart from that I like IT :)

    I will post a U-Tube video my first one ever :D and you can have a look at it there ;)

    If you need any help then let me know.

  7. My Ubuntu Lucid Splash

    Charlie as you can see the logo doesn’t get built because it’s so slow to build it – so any help with the above code (2 posts above) would be great :)

    http://www.youtube.com/watch?v=dWHUkWnOoi4

    Cheers,
    Peter

    • Piero
    • October 25th, 2010

    Hey Peter (same name as mine, other language)
    thank you very much. I have not checked this page for a while…
    Your offer of helping me is more than welcomed! Your boot sequence is stunning! Would you guide me through the process? i recently upgraded to 10.10 and I already solved a stupid boot issue that arose from it…I am pursuing the funny objective of emulating a Mac OS X (I use mac4Lin). The reason was that I did not want my wife to go through the hassle of learning another GUI. the boot sequence is of course more of a nerdy game…
    If I manage to do this I will inform the people of Mac4Lin
    Cheers,
    Piero

    • chilly
    • October 26th, 2012

    Hello, I am amazed with the script you created for plymouth.
    You know, I am trying to do a very simple thing with plymouth script, which is to take system time, and show diffrent background picture, but I cant seem to get around to it.
    would you happen to know what syntax to use to get system time in plymouth?

    • olahaye74
    • May 12th, 2017

    Excellent tutorial; that helped me a lot getting in touch with plymouth, unfortunately, I’m desperately trying to find an exhaustive language syntax+grammar and API with revisions, but NOTHING usefull so far :-(
    https://www.freedesktop.org/wiki/Software/Plymouth/Scripts/ is completely useless.
    How to I guess Math.Pi() exists? (strings script.so do”nt show it…)
    Or can I do switch case ?
    Can I change Font height (20 seems the default)
    How do I guess that Image.Text supports only 4 args in older version (0.8.4) and many more in newer versions (0.9.4) like alpha, font, align (I had to strings script.so to guess)
    Are there regexps support?
    Can I do string manipulation?
    Can I get string size?
    What is the difference between “plymouth message” and “plymouth status”?
    Many Many Many questions without any answer at all :-/
    Do I have to download all versions and reverse engineer the code? :-/

    I’m working on systemimager initrd.img which is responsible to deploy an image on local hard drive.
    I want to display messages and steps (icons at the bottom) with a progress bar for each steps….
    Really hard!

  1. No trackbacks yet.

This blog is kept spam free by WP-SpamFree.