If the game won't start properly

Started by Tynan, July 16, 2014, 04:46:40 PM

Previous topic - Next topic

thuban

Quote from: ttoocs on July 19, 2016, 03:39:48 PM
https://support.steampowered.com/kb_article.php?ref=1040-JWMT-2947
Tl;dr right click it, add lunch options, add options. (Given, if it runs that startup script.. you'll have to modify the startup script)
I cannot verify that though, steam doesn't run for me.

Adding launch option via steam wasn't working, so I modified directly the startup script in ~/.steam/steam/steamapps/common/RimWorld/start_RimWorld.sh

ttoocs


thuban


tskx

Quote from: ttoocs on July 19, 2016, 02:05:35 PM
Found, a working (for me), accelerated (not slow), fix.
Run the game with -force-opengl (A unity argument)
[...]
yeah -force-opengl did the trick for me as well, thanks a lot!

still it's odd that you have to "force" opengl since it should be the only mode available on linux  ???

Tynan

Quote from: tskx on July 19, 2016, 08:04:09 PM
Quote from: ttoocs on July 19, 2016, 02:05:35 PM
Found, a working (for me), accelerated (not slow), fix.
Run the game with -force-opengl (A unity argument)
[...]
yeah -force-opengl did the trick for me as well, thanks a lot!

still it's odd that you have to "force" opengl since it should be the only mode available on linux  ???

Seriously, I have no idea what else it's doing.

Maybe it would be good to put that in the default startup script? Though it seems a little ridiculous to have to do that.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

ttoocs

#215
From how it's phrased on the place I found it:

    -force-opengl: To use the legacy OpenGL back-end
    -force-glcore: To use the new OpenGL back-end. With this argument, Unity will detect all the features the platform support to run with the best OpenGL version possible and all available OpenGL extensions
    -force-glcoreXY: XY can be 32, 33, 40, 41, 42, 43, 44 or 45; each number representing a specific version of OpenGL. If the platform doesn't support a specific version of OpenGL, Unity will fallback to a supported version
    -force-clamped: Request that Unity doesn't use OpenGL extensions which guarantees that multiple platforms will execute the same code path. This is an approach to test if an issue is platform specific (a driver bug for example).

All of those should work/run on Linux, as GL-core is a mesa/Xorg/dri thing: https://dri.freedesktop.org/wiki/GLcore/
For some reason, somewhere, it seems to detect the features wrong... or it might not support pre 3.2 as hinted by the -glcore32 being the lowest value.

I know it helped pk4yahweh's mac which seemed to fall-back to software rendering (My guess is that macOSX can figure out "oh this is doing stuff not supported, to software rendering!")  (He was asking if this can be patched into the mac launcher?)

I'm not sure forcing it in every launch is a good idea though... as I guess unity seems to think there is some benefit of using newer functions, and I remember reading somewhere on their site that it does a fall-back to X software stuff when needed.. so running it this way might reduce performance/increase CPU usage.

I would recommend trying to detect this in some way though.. There is the command "glxinfo", which gives loads of information. And going through the strace's I remember seeing a good chunk of it's output.. I think Unity get's it it-self... In which case https://docs.unity3d.com/ScriptReference/SystemInfo-graphicsDeviceVersion.html might be useful, so you might be able to relaunch the game from itself with -force-opengl when needed. (OpenGL <3.2)

As for linux/mac scripts: 1 way, is to simply launch the game, and see if it crashes due to that error. (Ideally saving this result aswell so only on the first launch you get the crash..
There is also the command glxinfo, but it's not installed on everything by default, so it'd be a hit and miss.
(If it was scripting, I'd probably try to do a hybrid of both, as glxinfo would be more reliable and less jarring when it's available.. and there may be more methods idk of.)

p.s, I think it'd be a good idea to add $@ at the end of the line where the game in launched so that if someone modifies the steam launch options it'll get passed through to the game.

Edit: (Because my script is demanding and kinda complex, I'll try to do it when I get home)
Edit2: It's done, see two posts below.

ImperiumTactics

Run the game from Steam, screen pops-up all black, screen closes. No log is generated.
Deleted all configuration files, problem persists the same as before.
Edit: Linux user.


[attachment deleted by admin - too old]

ttoocs

#217
Here is a first-version of my script, that attempts to detect when it needs to run the game with -opengl-force.
This should fix it launching with a black screen and immediately crashing with slightly older hardware.

It does try to do it for mac as well, however, I do not know the structure of steam on a mac, and is hence very limited.

Put it in the directory where start_rimworld.sh is and it should work fine.

Here it is in a code block, but it is also an attachment.

#!/bin/bash
#Ttoocs's Launcher for the Linux (and maybe mac) version of RimWorld

LOGFILE="/tmp/rimworld_log"

#VERSION=1.0

#Due to bash, all functions are defined before their use.

#Code to check if the prior run had an SDL::Logic_error
check_prior_sdllogic_crash() {
if [ -e $LOGFILE ]; then
if grep -q "std::logic_error" $LOGFILE ; then
FORCEGL=" -force-opengl"
echo "Detected a prior crash in logfile due to too low an OpenGL version, Launching game with a fix"
fi
fi
}


#Code to check for OpenGL > 3.2, and set --force-opengl if required
setargs_force_opengl(){
FORCEGL="" #Assume all is okay untill proven not.

if which glxinfo | grep -q glxinfo ; then
OPENGL_VERSION=`glxinfo | grep "OpenGL version string:" | cut -d' ' -f 4`
if [[ (( $OPENGL_VERSION < 3.2 )) ]]; then
echo "Detected OpenGL versoin < 3.2, launching game with a fix"
FORCEGL=" -force-opengl"
else
check_prior_sdllogic_crash
fi
fi

}

rungame(){
#Runs the game, and if it detects a crash from sdl:logic error, where -force-opengl was no set,  re-runs the game"
#Echo's a forceGL string to the logfile at the end, if it didn't crash while running it that way
#

#run the game
./$GAMEFILE $LOG $FORCEGL $@

EXITVAL=$? #Get the exit value

if [[ $EXITVAL != "0" ]]; then #Check if it had an unclean exit
if [[ $FORCEGL == "" ]]; then #Check if -force-opengl was set
check_prior_sdllogic_crash
if [[ $FORCEGL != "" ]]; then #Check for sdlogic crash

echo "Sorry, the game crashed without the fix... trying again with it!"
#MAIN# (A copy-paste)
OS=`uname -s`
if [[ $OS == "Darwin" ]]; then
    runmacstuff
else
    runlinuxstuff
fi

fi
else
echo "Sorry, game still crashed with the -force-opengl fix."
fi
else
#Game exited okay!
if [[ $FORCEGL != "" ]]; then #Check if the fix was used.
echo  "Appending fix to new logfile"
echo  "Ttoocs script crash-saving thing std::logic_error" >> $LOGFILE #If it was, copy a trigger to run it again into the newest logfile
fi
fi
}


#Runs the required mac-stuff
runmacstuff() {
#NOTE: From pk4yahweh's case, this script _WILL NOT_ catch the case where Mac OSX runs the game in software rendering when glxgears is not installed.
#I'm not entierly sure how to fix that.

#NOTE: I'm not sure where it would be if installed via steam on a mac..
If it's possible to ship this script (and make it runnable as osx needs)
# then you can do a simmilar approch to linux.


if [ -d /Applications/RimWorld*Mac.app/Contents/MacOS/ ]; then
#Check if mac hdd install'd
DIR="/Applications/RimWorld*Mac.app/Contents/MacOS/"
else
if ls | egrep -i rimworld | egrep -q -i mac$ ; then #Cheks if it's in the game directory
DIR=`pwd`
else
#TODO: More/better detection of mac folders
echo "Not sure where the game is, sorry!"
exit
fi
fi

cd "$DIR"

#Get's the gamefile
GAMEFILE=`ls | egrep -i rimworld | egrep -i mac$`

#Sets a logfile
LOG="-logfile "$LOGFILE

#Sets the forcegl arg
setargs_force_opengl

rungame

}

#Runs the linux stuff
runlinuxstuff() {

# cd into the directory containing this script
SCRIPT=$(readlink -f "$0")
DIR=$(dirname "$SCRIPT")
cd "$DIR"

#Getting game executable name.
GAMEFILE=`ls | egrep x86$`

OSVERSION=`uname -m`
if [[ $OSVERSION == "x86_64" ]]
    then GAMEFILE=${GAMEFILE}_64
fi

LOG="-logfile "$LOGFILE

export LC_ALL=C #Locale resetting (important for Ubuntu players who are not native speakers of English) and launching the game.

#Sets the forcegl arg
setargs_force_opengl

rungame
}


#MAIN#

OS=`uname -s`
if [[ $OS == "Darwin" ]]; then
runmacstuff
else
runlinuxstuff
fi


[attachment deleted by admin - too old]

tskx

Quote from: ttoocs on July 20, 2016, 01:59:47 AM
Here is a first-version of my script, that attempts to detect when it needs to run the game with -opengl-force.
This should fix it launching with a black screen and immediately crashing with slightly older hardware.

It does try to do it for mac as well, however, I do not know the structure of steam on a mac, and is hence very limited.

Put it in the directory where start_rimworld.sh is and it should work fine.

Here it is in a code block, but it is also an attachment.
[...]

Your script works fine for me. If it's working for mac, maybe Tynan could use it till unity gets it right. That said is there a bug report for unity?

I use the opensource "radeon" driver (3.0 Mesa 12.0.1) since the close source driver doesn't work with 4 monitors. (gfx driver are a mess, be it amd or nvidia)

Maybe thats the big difference here why it works for some and some not. Oddly enough i have no problems with starting other unity 5 games.

ttoocs

So I went and bugged the mesa-dri people, and some people on Steam Linux Users Group about -force-opengl vs -force-glcore. In conclusion:
(-force-glcore) : it's probably referring to core vs compatibility profiles which only exsist in opengl 3.1+ (And only got decent till 3.2) Which explains why it needs opengl 3.2+ (https://www.opengl.org/wiki/Core_And_Compatibility_in_Contexts)
and (-force-opengl) : which is Unity's legacy render, which just needs OpenGL 2.0.
They also say that using -force-opengl shouldn't impact performance. (My caution seems unneeded)
And that it is something you can set in unity's player build settings. - which would fix needing any script at all on mac, and the old script would be fine for Linux (although I still suggest adding a $@ at the end of it)

Tynan

Quote from: ttoocs on July 20, 2016, 01:24:09 PM
And that it is something you can set in unity's player build settings. - which would fix needing any script at all on mac, and the old script would be fine for Linux (although I still suggest adding a $@ at the end of it)

Do you think this is something I should do?
Tynan Sylvester - @TynanSylvester - Tynan's Blog

ttoocs

#221
It doesn't sound like it hampers anything at the moment, "it should just be a matter of new features", so you may as well.  (I'm thinking it'd just be graphical features, but I may be wrong.) But for a fix, it'll solve the problem.

Quote
[11:36] <Tak> it _should_ only affect new features
[11:37] <Tak> well, the legacy renderer will go away in unity 5.5
[11:37] <Tak> at that point, people will need drivers that support core profile 3.2
[11:37] <Tak> (which even mesa on intel does now)

loc978

#222
Well, I'm on board with the forced opengl start. Not sure how to make it work with the steam version, but I've managed to play the DRM-free version without a problem using a cut down script more in keeping with my usual "double-click the executable" tradition (mostly because I can't just double-click the .sh file to run it) :
#!/bin/bash
./RimWorld1238Linux.x86_64 -force-opengl

...in a file simply titled "launch"
*edit* I also keep a version of the file one directory down with "./RimWorldxxxxLinux.x86_64" in there for easy, four keystroke updating.

thank you for that tidbit of unity knowledge, ttoocs

*edit2* feeling quite stupid... of course the steam version just runs ~/.steam/steam/steamapps/common/RimWorld/start_RimWorld.sh ...so I just applied -force-opengl to the end of that file and it launches from steam like nothing is wrong.

e6719039

Hello!

Unfortunately for me  the game won't run on my computer either, already followed the steps  on the frist post to no avail.

I recently got the game on steam , hasn't been able to run it properly even once. When i open the game i get a crash after a few seconds ( i have gotten as far as being able to push the "new colony" button  but sometimes it crashes before the menu loads.

Im attaching the log of two  of the crashes  i have had , the first one is with the game configured in spanish, the second one in english.

I also tryed to force opengl mode "force-opengl"  in this case i can get to play but everything is pink

http://pasteboard.co/dUrmImoHZ.png
http://pasteboard.co/1ofeF3qkt.png

Also atttaching the log for this test as -pink

My computer specs are as follows
Processor Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
Video Card Gigabyte GV-R797OC-3GD 
RAM 16 GB
Operating System Microsoft Windows 10 (build 10586), 64-bit

I have uninstalled and reinstalled the game multiple times, trying in 2 different drives. The computer has been rebooted a few times between diferent test
ANything else i could try ?




[attachment deleted by admin - too old]

ttoocs

#224
When it's run with -force-opengl there are 373 instances of "null texture passed to GUI.DrawTexture", which is where the pink would be from.. which is strange.. There is another argument that you _could_ try for blind luck, but no idea if it would work: "-force-d3d11"

On the first crash.txt, it looks like it the Spanish language files are messed up, and then it _might_ be crashing because it can't name things..
My best guess from that is to try to get it to run in English, and see if that helps. (if you're already running it in english... well... I guess it's just kinda corrupted? in which case try the registry fix attached to the first post)

Idk how the windows version logs it-self... but the logs seem cut-off... but that might just be how it's run. I'm test that abit.
Nope, windows is just like that.

Edit: The crash_2.txt looks like it's just initializing it... and then exiting properly. The crash.txt just gets cut off, which I guess is the game crashing.
Sorry, no new ideas as to what to do. (other than the two original ones I had, but idk if they work at all.)