CW3 Linux Native Version

Started by knucracker, January 08, 2014, 08:58:06 PM

Previous topic - Next topic

timotimo

I've briefly tested it on my 64bit linux mint 15 "olivia" (the version based on ubuntu) and it seems to work fine. Playing and submitting high scores, that is. I've played the first few levels of the campaign and here's the things I've noticed:


  • settings don't stick reliably after exiting the program; after a few tries it did seem to work, however (?!?)
  • when exiting via the "exit game" button from the main menu, it says "Killed" in the console, so it didn't shut down cleanly, perhaps that's what caused settings to not stick?
  • as opposed to the wine version, zooming with the mousewheel worked instantly. very nice!
  • when maximizing the window in the wine version, the framerate dropped by a ridiculous amount; it went from silky smooth (with a GeForce GTX 560 Ti) to unbearable. in the native linux version it runs splendidly with the maximized window

Thanks a lot for taking the time to polish up a nice linux port :)

It seems like you don't half-ass things at all, the whole thing is very polished and I was very happy to see that "fresh ideas in gaming" is more than just a crappy slogan; the campaign had some new twist to offer at every point!

lvdata

#16
The "Hardware" is a 2 core I7 VMware virtual computer. The hardware underlying the VM is a ATI Radeon 4550, 4core/8threadCPU w/ 18GB Ram, SSD for Boot, and Adaptc Raid for bulk data storeage.  The drivers are the normal VMware drivers installed from VMware Tools. No hand configuration necessary.

There is a graphics problem if you are in CS, and resize the window so that NO lines of missions are visible, the CS menu disappears, and you see the main screen. When I found this, I also tried it under Win7x64, and encountered the same bug, see attached screen capture.  

Also I just noticed the Icon is just a black outline of your command node.  

Resizing during play works ok, and full screen works ok.  

The load on the main screen keeps looking for "/Volumes" and repeatedly gives you a error message that it can't be found. "OK" is your only option, and if you ignore it you can eventually load a map from a file.

Network functionally is ok, I can retrieve and post scores, and the Forum link for each map works ok.

My mouse wheel works ok, and I can re-map keys and it will stick after exiting and restarting CW3.

LvData

Quote from: virgilw on January 09, 2014, 08:33:10 AM
That's awesome news to hear it worked for you and with good performance!
What kind of GPU do you have in your system?  Were the GPU drivers part of ubuntu or did you have to configure them by hand?

Now, additional things to test.  Please make sure you have any important work closed on your linux machine before testing.  If the game sticks in full screen or something I don't want you to lose any important work.
- Try full screen and various window sizes.  Try resizing the window by dragging the bottom right corner.
- Try to load a mission using the Load File functionality from the main menu.
- Try posting scores, loading CS, DMD, etc.  Anything that uses network functionality.
- Try remapping input controls in the settings.  (Also, make sure the scroll wheel is working for zooming by default).

These are the areas I'm most concerned with since I've seen spurious reports with Unity and Linux with other games from google results over the last couple years.



nineinchnick

Quote from: virgilw on January 09, 2014, 07:08:05 PM
The exception if from InputManager when it is trying to read the XML file.  It uses mono's XmlDocument to try to read and parse the xml doc, and that appears to be throwing an 'Unknown Char' exception on the dot that is in the first line of the InputManager.xml document:
<?xml version="1.0" encoding="utf-16"?>

If you copied this file over from windows installation, try deleting your InputManager.xml file and letting the game create it from scratch.  I'm curious if it will write it out with the dot in "1.0".

What do you mean by "maps also contain double values"?

At first I tried running it with the windows file but then I just removed it. I didn't have any custom mapping anyway. That parser is funny to try to use localized double/float parser in that xml preamble.

Ignore my other ideas about other files, the exception clearly states where it happens.

knucracker

Let me summarize what I think are the three main issues that have been identified and what I can do about each one:

1: /Volumes access and other file related errors.  This was being caused by an old version of UniFileBrowser that I was using.  The popup file browse dialog you see when you try to load a mission from a file... that guy.  That was from the unity asset store and didn't support linux properly.  I've updated to the latest version, reskinned it, and things seem better now.  Interestingly, it was this same asset that caused the hold up on the Linux build, I just didn't know it.  The old version was calling Application.Exit() out of the blue because it didn't recognize linux.  That took a while to find, and was the main barrier to releasing the Linux build (hand slaps forehead, I know).

2: Resizing the window really small in CS causes a goof up.  This is a high level bug that affect all versions.  I've just fixed it.

3: At least on pl_PL locale, there is an issue parsing the InputManager.xml file.  Further investigation shows me that the problem is when I try to parse strings formatted as floating point numbers into floats.  The parse routine is culture aware so it expects commas in some locales.  I should be able to force a fixed format within the parsing routine.  This should avoid having to set LANG=C.  Hopefully, I won't break all other platforms when I fix this :)

There were other misc issues that some folks seem to have.  These might be related to GPU driver issues, or other things I don't have much control over.  Or they might be side effects to any of the three above problems.  I'll roll a new build with fixes for the above three things later today then  we can take it from there and see where it stands.

Jesster_King

I am running linux but I don't know how to install it, kind of a noob at command line stuff.

knucracker

tar -xzvf CreeperWorld3-157-linux.tgz

Or there abouts...  That will extract the file into a CreeperWorld3 dir. 
There you need to cd in that CreeperWorld3 dir and run ./CW3.x86

There may be a graphical way to do this, but I'm not sure.  I would imagine that some file manager might let you double click the tgz file and then extract it.

knucracker

This parser/locale/cultureinfo thing is most troubling...
Turns out if I start from scratch on linux and specify LANG=pl_PL I will get an InputManager.xml file created where floating point values that have commas rather than periods.  Of course if I copy an InputManager.xml file from my US english windows box the InputManager.xml file contains periods.

Basically Float.ToString() and Float.Parse() use the current locale to determine their format.  That's just capital.

On your windows machine do you have it set to some locale that uses periods in decimal numbers (like us english)?  If not, then I wonder why your InputManager.xml file didn't contain commas.
Try this experiment.

On your windows machine delete or rename you InputManager.xml file.  Then run the game, then look at the InputManager.xml file that got created.  Look for this line near the top of the file:
<keyboardScroll>0.5</keyboardScroll>

Now do the same thing on your linux box.  On my linux system when I set LANG=pl_PL the line looks like this:
<keyboardScroll>0,5</keyboardScroll>

The question is what the line looks like on a non us english windows system (one where the locale uses commas rather than periods).

randomer

Hey,

it seems to run fine if I run the executable as root, however launching it via ./CW3.x86 as a normal user just opens a black window.
So I guess there are some missing permissions, but my user has read/write rights for the CW3_Data folder. Any idea what I might be missing?

Cheers,
randomer

nineinchnick

#23
It shouldn't require root, I run it as a ordinary user from the beginning. Maybe you ran it as root for the first time and now it tries to overwrite dirs/files created by root. Check the log for error messages at $HOME/.config/unity3d/Knuckle\ Cracker\ LLC/Creeper\ World\ 3/Player.log

I'm attaching my log after clearing all save files and config files and running with locale as below:

LANG=pl_PL.utf8
LC_CTYPE="pl_PL.utf8"
LC_NUMERIC="pl_PL.utf8"
LC_TIME="pl_PL.utf8"
LC_COLLATE=pl_PL.utf8
LC_MONETARY="pl_PL.utf8"
LC_MESSAGES="pl_PL.utf8"
LC_PAPER="pl_PL.utf8"
LC_NAME="pl_PL.utf8"
LC_ADDRESS="pl_PL.utf8"
LC_TELEPHONE="pl_PL.utf8"
LC_MEASUREMENT="pl_PL.utf8"
LC_IDENTIFICATION="pl_PL.utf8"
LC_ALL=


It seems that config files are created properly but there are other game XML files created by Virgil with an english locale and the parser breaks on them.

BTW After I create the files with polish locale and then run the game with C locale all double values are rounded to either 1 or 0 :-) So it kinda works the other way.

Previously I played on wine. My wine in general is in polish but the game config files are created with dots. I can't test on a Windows box because I don't use Windows at all.

knucracker

Yes... this is making sense in an odd sort of way.  Unity uses the mono runtime.  It seems that the version of mono they use always reports en_US when on windows.  So all of the windows versions think they are in the US locale regardless of the actual machine locale.  This is why all of the files, custom maps, etc. have data encoded using a period as the decimal mark.

Now the linux version of the mono runtime... it apparently reports the actual machine locale.  This is why the game breaks on linux if the locale isn't a locale that uses a period for the decimal mark.  Forcing the locale of course makes the game run fine as you have observed.

Now in theory I can force the locale for linux from within the game code itself.  I'm attempting to do that right now and will test. If so, this will correct the issue on linux.

timotimo

Please pass CultureInfo.InvariantCulture as the last parameter to Float.ToString or Float.Parse. That will be much more robust.

Details: http://stackoverflow.com/questions/147801/best-way-to-parse-float

timotimo

here's a tiny visual artifact i've experienced when zooming out a bit on my laptop, which has a "Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b)" (it's a thinkpad x200s).
There are thin black lines visible in the "soylent" near my control node.

knucracker

I've updated the link in the top post with a 158 build for all platforms, including linux.  Grab this version and give it a try.  If you are in a locale that uses commas for the decimal mark, then please nuke your InputManager.xml file before starting the new version.  If you don't you might have some commas in the file that will cause problems.  This is try for the linux build and of OSX as well.

I changed the way the app exits so you should no longer see a 'killed' message when you exit the game.  And I of course have attempted to address the locale problem.  The code is scattered with float and double marshaling and I can't be sure some package I use doesn't use that as well.  So I went with a technique for setting the default locale for the whole app.  For the windows builds this should make no difference.  Apparently the version of mono that Unity uses for windows had a lazy man's bug in that the locale was always reported as en_US.  So the windows builds always use a period for a decimal mark.  Only the linux and OSX builds actually report the locale properly.  Anyway, I force everything to invariant now so in theory everything should be cool.

I have tested under ubuntu 12.04 and tried pl_PL as a locale and the updated version of CW3 seems to work properly.  


knucracker

Quote from: timotimo on January 10, 2014, 07:35:30 PM
here's a tiny visual artifact i've experienced when zooming out a bit on my laptop, which has a "Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b)" (it's a thinkpad x200s).
There are thin black lines visible in the "soylent" near my control node.

That is likely because of forced anti-aliasing in the GPU.  I have no idea where that is controlled under linux.  In windows it is usually in the control panel for the graphics card.
CW3 requires antialiasing be disabled for creeper rendering, else you get those overlap 'bleed' artifacts.  I disable AA in the code, but at least on windows GPU settings can override that.

timotimo

for intel graphics cards, the utility to do those things is usually "driconf" (for nvidia, it's "nvidia-settings"), but that doesn't have any mention of AA :(
A quick google search didn't turn up any way to force AA to be off or on for intel linux drivers.