The forum

[Script] osu!

Author Replies
Jump to the page: 1 - 2 - 3
boat Friday 4 October 2013 at 18:06
boat

osu! is a free-to-play rhytm game, developed by Dean "peppy" Herbert. The game features several gamemodes based on other rhytm games such as Elite Beat Agents, Taiko no Tatsujin and Beatmania, with online leaderboards, multiplayer and various other features.

In order to have full access to the game you've got to register for an account https://osu.ppy.sh/p/register

Note that you are required to have an account in order to download playable tracks (beatmaps). These can be found here http://osu.ppy.sh/p/beatmaplist

You install the beatmaps by either opening them with osu! (usually works) or putting the files in the osu!/songs/ folder.

This is a pretty simple little script I wrote to install osu!
The procedure of downloading the osume.exe updater in to a program files/osu! folder is currently the only known way to get it working, and this is pretty much what this script does for you.

Tested several times on two machines with Wine 1.7.3 and POL 4.2.1, works like a charm.

http://osu.ppy.sh/

[code language=playonlinux]
#!/bin/bash
# Date : (2013-10-06 14-11)
# Last revision : (2013-10-06 14-11)
# Wine version used : 1.7.3
# Distribution used to test : Ubuntu 12.04 LTS
# Author : boat
  
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
TITLE="osu!"
PREFIX="osu_on_linux"
WINEVERSION="1.7.3"
EDITOR="peppy"
GAME_URL="http://osu.ppy.sh/"
AUTHOR="boat"
 
# Download images for installation script
POL_GetSetupImages "http://horobox.co.uk/u/failboat_1381126540.png" "http://horobox.co.uk/u/failboat_1381129163.png" "$TITLE"
 
# Initialize the script, debugging
POL_SetupWindow_Init
POL_Debug_Init
 
# Setup presentation window
POL_SetupWindow_presentation "$TITLE" "$EDITOR" "$GAME_URL" "$AUTHOR" "$PREFIX"
 
# Begin setting up the Wine Prefix  
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WINEVERSION"
 
# Install .NET Framework 2.0
POL_Call POL_Install_dotnet20
 
# Create and select the required directory for the updater
mkdir "$WINEPREFIX/drive_c/$PROGRAMFILES/osu!"
cd "$WINEPREFIX/drive_c/$PROGRAMFILES/osu!"
 
# Download the updater and config file (the config file is required for osu! to launch properly).
POL_Download "http://osu.ppy.sh/release/osume.exe"
POL_Download "http://www.boaty.org/POL/osu!.user.cfg"

mv "osu!.user.cfg" "osu!.$USER.cfg"

# Run the updater
POL_SetupWindow_message "$(eval_gettext 'Press next to start the updater. When the updater is finished, close it down. Do not start osu! yet.')" "$TITLE"
  
POL_Wine osume.exe
 
# Wait for the updater to finish in order to create a shortcut of the executable
POL_Wine_WaitExit "$TITLE"
 
POL_Shortcut "osu!.exe" "osu!"

# Ask if the user wants to enable StrictDrawOrdering
POL_SetupWindow_question "Would you like to enable StrictDrawOrdering?
This is known to fix visual errors for users with AMD graphics cards and is generally recommended." "$TITLE"
 
if [ "$APP_ANSWER" = "TRUE" ]
then
   POL_Wine_Direct3D "StrictDrawOrdering" "enabled"
fi
# Ask if the user wants to register an account
POL_SetupWindow_question "It is recommended that you register for an account and download some beatmaps before you start playing. Pressing yes will take you to the registration page, pressing no will finish the installation." "$TITLE"
 
if [ "$APP_ANSWER" = "TRUE" ]
then
POL_Browser "https://osu.ppy.sh/p/register"
fi
POL_SetupWindow_Close
exit
[/code]

Screenshots:
http://horobox.co.uk/u/failboat_1380922686.jpg
http://horobox.co.uk/u/failboat_1380959628.jpg
http://horobox.co.uk/u/failboat_1380966046.jpg

Icons and installer resources
http://www.mediafire.com/download/s14kk1d42kvf35t/osu_resources.7z

Edited by boat

petch Friday 4 October 2013 at 19:21
petch

Hi boat,

See the other thread for discussion about directory paths: http://www.playonlinux.com/en/topic-11062-Issue_with_creating_directories_with_script.html

I fail to see the point of all those POL_SetupWindow_message between each step of the installation. Maybe they were useful for you for debugging, but they'll definitely be unexpected, and probably an annoyance, for users.

Re-selecting the prefix (l. 24) is useless.

The game has to be ran through the osu.exe located in program files/osu!/, unless anyone has a suggestion for a solution to this.

Quote

I'm not sure I understand the issue, is it that the script should only continue after osume.exe as finished running? If so,
POL_Wine start osume.exe

"start" is probably useless, try removing it. If that's not sufficient to make the script wait for the program to end, add a POL_Wine_WaitExit "$TITLE" statement just after this one.
boat Friday 4 October 2013 at 20:18
boat

Thank you loads, I sorted it out. Your suggestion was spot on, I had to tell it to wait for osume to finish updating until I could make the shortcut from the launcher.

I got rid of most of the message windows as well. Updated the code in the OP.

Tested it and it works fine, osu! launches like it should.

The only issue is with the last message being  "Please wait while a script being is being installed". Is there a way to get rid of this?

Edited by boat

petch Friday 4 October 2013 at 22:58
petch

At that point the script is waiting for the updater to finish, about just as it says, and it should disappear when the script goes on...
I'm not quite sure what you'd like in its place
boat Friday 4 October 2013 at 23:01
boat

Well it's not of any major importance, and I'll leave it as is if the rest looks good.
boat Sunday 6 October 2013 at 14:20
boat

I can't find any documentation on how to enable (generally anything under "Configure > Display") strictdrawordering through a POL script. This is almost required for the game to run without visual errors on AMD gpus, how would I go on enabling it?
markingdude Sunday 6 October 2013 at 14:28
markingdudeAnonymous

I can't find any documentation on how to enable (generally anything under "Configure > Display") strictdrawordering through a POL script. This is almost required for the game to run without visual errors on AMD gpus, how would I go on enabling it?

Quote from boat


From what I've found, this is what you're looking for:
[code language=playonlinux]
POL_Wine_Direct3D "StrictDrawOrdering" "enabled"
[/code]

The documentation does mention this, but to find the values, you'll have to look here under "Direct 3D".

Edited by markingdude

boat Sunday 6 October 2013 at 14:39
boat

That did it, thank you.

Updated the script in the OP.

Edited by boat

markingdude Sunday 6 October 2013 at 15:06
markingdudeAnonymous

No problem.

I was looking at your script and am wondering if it's necessary to give the option to the user to enable the strict draw ordering value rather than simply enabling it automatically. Is there any negative effect that happens for those without AMD GPU's? I'm not too familar with osu!, but it might be something to test out.

Also in your script after "source "$PLAYONLINUX/lib/sources", you should have something like this to meet guidelines.

# Setup some needed variables
TITLE="osu!"
PREFIX="osu_on_linux"
WINEVERSION="1.7.3"
EDITOR="peppy"
GAME_URL="http://osu.ppy.sh/"
AUTHOR="boat"


That way, your setup presentation line becomes:

POL_SetupWindow_presentation "$TITLE" "$EDITOR" "$GAME_URL" "$AUTHOR" "$PREFIX"


Be sure to also fix this throughout your script as well. I noticed you manually named your variables in the lines that are needed rather than using the stuff above. Setting up variables like these makes it easier to code your script and easier on those who read it.

Edited by markingdude

boat Sunday 6 October 2013 at 15:22
boat

It generally decreases performance by a good amount even on higher end hardware. It's a subjective matter of "playability", many returning experienced players will probably prefer to keep it disabled even if it causes glitching as there are ways to work around it, to some extent.

Of course I could leave it enabled by default as it's by no means hard to disable it. I can't really say if it's necessary or not as it depends a lot of personal preference and your hardware. I'll need some more opinions on this.

And thank you for the help. I highly appreciate it.

Edited by boat

markingdude Sunday 6 October 2013 at 15:30
markingdudeAnonymous

It generally decreases performance by a good amount even on higher end hardware. It's a subjective matter of "playability", many returning experienced players will probably prefer to keep it disabled even if it causes glitching as there are ways to work around it, to some extent.

Of course I could leave it enabled by default as it's by no means hard to disable it. I can't really say if it's necessary or not as it depends a lot of personal preference and your hardware. I'll need some more opinions on this.

And thank you for the help. I highly appreciate it.

Quote from boat


Oh OK. If it were me writing the script, I'd probably keep it that way, since you say it does decrease performance. I don't claim to be a scripting expert, but one of my goals is making the installation as easy and transparent as possible. This isn't always the case, but it's something I try to achieve.

Also, I edited this in so I don't know if you saw it, but:

Also in your script after "source "$PLAYONLINUX/lib/sources", you should have something like this to meet guidelines.

# Setup some needed variables
TITLE="osu!"
PREFIX="osu_on_linux"
WINEVERSION="1.7.3"
EDITOR="peppy"
GAME_URL="http://osu.ppy.sh/"
AUTHOR="boat"


That way, your setup presentation line as an example becomes:

POL_SetupWindow_presentation "$TITLE" "$EDITOR" "$GAME_URL" "$AUTHOR" "$PREFIX"


Be
sure to also fix this throughout your script as well. I noticed you
manually named your variables in the lines that are needed rather than
using the stuff above. Setting up variables like these makes it easier
to code your script and easier on those who read it.

Edited by markingdude

boat Sunday 6 October 2013 at 15:38
boat

I did see it, fixed what I could find and added some comments as well. Thank you once again.

Tested the script again, everything works the way it should. Updated.

About POL_GetSetupImages though, if I can host them myself, should I add them to the script?

Oh god what happened to the formatting

Edited by boat

markingdude Sunday 6 October 2013 at 15:57
markingdudeAnonymous

I did see it, fixed what I could find and added some comments as well. Thank you once again.

Tested the script again, everything works the way it should. Updated.

Quote from boat


Not a problem. Nice to know that my advice helped you.

I tested your script as well (always wanted to try osu! since I loved Elite Beat Agents on DS), and I found a few things:

POL_Wine_PrefixCreate

This crashed the updater for me, so it should be
POL_Wine_PrefixCreate "$WINEVERSION"

to tell PlayOnMac/Linux to use Wine 1.7.3.

POL_SetupWindow_message "When the updater is finished, close it down. Don't start osu! yet." "$TITLE"


When having messages like these, make sure you add "$eval_gettext" before the message like this:

POL_SetupWindow_message "$(eval_gettext 'When the updater is finished, close it down. Don't start osu! yet.')" "$TITLE"

Edited by markingdude

boat Sunday 6 October 2013 at 16:07
boat

Alright, fixed.

The script freezes at downloading the osume.exe, not sure why, downloading it manually works. I'll try getting somebody else to test it for me.

Edit: Actually, it downloaded fine without the eval_gettext line.

Edited by boat

markingdude Sunday 6 October 2013 at 16:33
markingdudeAnonymous

Alright, fixed.

The script freezes at downloading the osume.exe, not sure why, downloading it manually works. I'll try getting somebody else to test it for me.

Edit: Actually, it downloaded fine without the eval_gettext line.

Quote from boat


This is because it didn't like the "Don't" part in your sentence (additional (), ', and " can't be used with eval_gettext). It should be:

[code language=playonlinux]
POL_SetupWindow_message "$(eval_gettext 'When the updater is finished, close it down. Do not start osu! yet.')" "$TITLE"[/code]
boat Sunday 6 October 2013 at 17:44
boat

Alright, yeah, this works. I don't really know what this does, so is it required for the following setupwindow messages?
markingdude Sunday 6 October 2013 at 18:21
markingdudeAnonymous

Yeah, this is needed per the documentation (http://www.playonlinux.com/en/dev-documentation-10.html).

"The command eval_gettext takes an english message as argument, and returns its translation into current user's language (as automatically determined)."
boat Monday 7 October 2013 at 16:18
boat

Edit: nevermind, missinterpreted

Edited by boat

markingdude Tuesday 8 October 2013 at 0:03
markingdudeAnonymous

Just a couple more things on your code.

# Download the updater
POL_Download http://osu.ppy.sh/release/osume.exe


Put quotation marks around the URL here.

# Ask if the user wants to enable StrictDrawOrdering 
POL_SetupWindow_question "Would you like to enable StrictDrawOrdering?

This is known to fix visual errors for users with AMD graphics cards and is generally recommended." "$TITLE"


Weird spacing here. The installer won't recognize that as a newline anyway. I would just remove that. Other than that, the script looks good to me.


About POL_GetSetupImages though, if I can host them myself, should I add them to the script?

Quote


Yeah you should. I'm not sure how petch handles hosted images, but when posting your scripts for submission and approval I would do that.

Edited by markingdude

boat Tuesday 8 October 2013 at 16:35
boat

Alright, updated the script and resources. Thanks for all the help.

The setup images are on a reliable host.

Edited by boat