Jump to content

Linux, You Changed Man


Josh

3,103 views

 Share

I recently fired up an install of Ubuntu 20.04 to see what the state of development on Linux is now, and it looks like things have improved dramatically since I first started working with Linux in 2013. Visual Studio Code looks and works great on Linux, and I was able to load the Ultra Engine source code and start compiling, although there is still much work to do. The debugger is fantastic, especially after using the Code::Blocks debugger on Linux, which was absolutely sadistic. (They're both using GDB under the hood but the interface on Code::Blocks was basically unusable.) Regardless of whatever their motivation was, Microsoft (or rather, the developers of the Atom editor VS Code was based on) has made a huge contribution to usability on the Linux desktop. 

679123386_Screenshotfrom2021-05-0113-20-11.thumb.png.3c24a6f385e5b06d54930c87b140f6fe.png

Settings up C++ compilation in Visual Studio Code is rather painful. You have to edit a lot of configuration files by hand to specify the exact command line GCC should use, but it is possible:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++ build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-g",
                "-D_ULTRA_APPKIT",
                "./Libraries/Plugin SDK/GMFSDK.cpp",
                "./Libraries/Plugin SDK/MemReader.cpp",
                "./Libraries/Plugin SDK/MemWriter.cpp",
                "./Libraries/Plugin SDK/TextureInfo.cpp",
                "./Libraries/Plugin SDK/Utilities.cpp",
                "./Libraries/Plugin SDK/half/half.cpp",
                "./Libraries/freeprocess/freeprocess.c",
                "./Libraries/s3tc-dxt-decompressionr/s3tc.cpp",
                "./Libraries/stb_dxt/stb_dxt.cpp",                
                "./Classes/Object.cpp",
                "./Classes/Math/Math_.cpp",
                "./Classes/Math/Vec2.cpp",
                "./Classes/Math/Vec3.cpp",
                "./Classes/Math/Vec4.cpp",
                "./Classes/Math/iVec2.cpp",
                "./Classes/Math/iVec3.cpp",
                "./Classes/Math/iVec4.cpp",
                "./Classes/String.cpp",
                "./Classes/WString.cpp",
                "./Classes/Display.cpp",
                "./Classes/IDSystem.cpp",
                "./Classes/JSON.cpp",
                "./Functions.cpp",
                "./Classes/GUI/Event.cpp",
                "./Classes/GUI/EventQueue.cpp",
                "./Classes/Language.cpp",
                "./Classes/FileSystem/Stream.cpp",
                "./Classes/FileSystem/BufferStream.cpp",
                "./Classes/FileSystem/FileSystemWatcher.cpp",
                "./Classes/GameEngine.cpp",
                "./Classes/Clock.cpp",
                "./Classes/Buffer.cpp",
                "./Classes/BufferPool.cpp",
                "./Classes/GUI/Interface.cpp",
                "./Classes/GUI/Widget.cpp",
                "./Classes/GUI/Panel.cpp",
                "./Classes/GUI/Slider.cpp",
                "./Classes/GUI/Label.cpp",
                "./Classes/GUI/Button.cpp",
                "./Classes/GUI/TextField.cpp",
                "./Classes/GUI/TreeView.cpp",
                "./Classes/GUI/TextArea.cpp",
                "./Classes/GUI/Tabber.cpp",
                "./Classes/GUI/ListBox.cpp",
                "./Classes/GUI/ProgressBar.cpp",
                "./Classes/GUI/ComboBox.cpp",
                "./Classes/GUI/Menu.cpp",
                "./Classes/Window/LinuxWindow.cpp",
                "./Classes/Timer.cpp",
                "./Classes/Process.cpp",
                "./Classes/FileSystem/StreamBuffer.cpp",
                "./Classes/Multithreading/Thread.cpp",
                "./Classes/Multithreading/Mutex.cpp",
                "./Classes/Multithreading/ThreadManager.cpp",
                "./Classes/Loaders/Loader.cpp",
                "./Classes/Loaders/DDSTextureLoader.cpp",
                "./Classes/Assets/Asset.cpp",
                "./Classes/Plugin.cpp",
                "./Classes/Assets/Font.cpp",
                "./Classes/FileSystem/Package.cpp",
                "./Classes/Graphics/Pixmap.cpp",
                "./Classes/Graphics/Icon.cpp",
                "./AppKit.cpp"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

Our old friend Steam of course looks great on Linux and runs perfectly.

1073891482_Screenshotfrom2021-05-0113-20-50.thumb.png.0ed524fb820e368bae3689b08aee19fb.png

But the most amazing thing about my install of Ubuntu 20.04 is that it's running on the Windows 10 desktop:

Untitled.thumb.jpg.d544c0aa2286b3d0d2a246f0853a333b.jpg

Hyper-V makes it easy to create a virtual machine and run Linux and Windows at the same time. Here are some tips I have found while working with it:

First, make sure you are allocating enough hard drive space and memory, because you are unlikely to be able to change these later on. I tried expanding the virtual hard drive, and after that Ubuntu would not load in the virtual machine, so just consider these settings to be locked. I gave my new VM 256 GB hard drive space and used the dynamic memory setting to allocate memory as-needed.

Second, by default Ubuntu is only going to give you a 1024x768 window. You can change this but it requires a little work. Open the terminal in Ubuntu and type this command:

sudo nautilus /etc/default/grub

This will open the file browser and select the GRUB file, which stores system settings. Open the file with a text editor. Since the file was opened from a nautilus window with super-user permissions, the text editor will also be launched with permissions.

Find this line of text:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Change it to this. You can set the screen resolution to whatever value you prefer:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1920x1080"

Close the text editor and the nautilus window. In the terminal, run this command:

sudo update-grub

Restart the virtual machine and your new screen resolution will work. However, the DPI scaling in Ubuntu seems to be not very reliable. My laptop uses a 1920x1080 screen, and at 17" this really needs to be scaled up to 125%. I could not get "fractional scaling" to work. The solution is to set your Windows desktop resolution to whatever value feels comfortable at 100% scaling. In my case, this was 1600x900. Then set Ubuntu's screen resolution to the same. When the window is maximized you will have a screen that is scaled the way you want.

screen.thumb.jpg.4ea98f74c2266ef4ba6cb2893f80b560.jpg

Checkpoints are a wonderful feature that allow you to easily walk back any changes you make to the virtual machine. You can see the steps I went through on to install all the software I wanted to work on Linux:

hyperv.thumb.png.04eefbe03e81e9a2f871a2ba1db5f7c1.png

If I ever mess anything up, I can easily revert back to whatever point I want. You can probably transfer the virtual machine between computers very easily, too, although I have not tried this yet. Changing the VM disk size, however, requires that you delete all checkpoints. So like I said, don't do that. My disk size is set to 256 GB, but in reality the whole VM is only taking up about 25 GB on my real hard drive.

The "type clipboard text" feature in Hyper-V does not work at all with Linux, so don't even try.

Pro tip: If you ever get stuck in the virtual machine, you can press Ctrl + Alt + Left arrow to bring the focus back to the Windows desktop.

Hyper-V isn't going to allow you to play games with Vulkan or OpenGL, but for other software development it seems to work very well. It's a bit slow, but the convenience of running Linux on the Windows desktop and being able to switch back and forth instantly more than makes up for it.

Super Bonus Tip

I found that regardless of how much disk space you allocate for the virtual machine, the Windows default install of Ubuntu 20.04 will still only use 12 GB on the main drive partition. If you try to resize this in the built-in tools, an error will occur, something like "Failed to set partition size on device. Unable to satisfy all constraints on the partition."

To resize the partition you must install gparted:

sudo apt install gparted

When you run the application it will look like this. Right-click on the ext4 partition and select the Resize/Move menu item:

1490795887_Screenshotfrom2021-05-0205-30-16.thumb.png.8a62ee5ee05300524fa1ae34540743b6.png

Set the new partition size and press the Resize button. 

Extreme Double Bonus Tip

If at any time you are running gparted you see an error like "Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all of the space" you should press the Fix button. If you don't do this, the partition resize won't work and will display some errors.

After the partition resize, the VM files on Windows are still only using about 21 GB, so it looks like Hyper-V doesn't allocate more disk space than it has to.

Crazy Extra Tip

Both VS Code and Brave browser (and probably Chrome) have an option to use a much better looking "custom titlebar" instead of the ugly GTK+ titlebar buttons.

  • Like 2
 Share

10 Comments


Recommended Comments

Yes , this days, Linux makes a really good desktop, developer environment.

Good to see you got this setup and hoping for UAK on linux :)

 

 

Link to comment

Gonna be real. Once Ultra Engine/App Kit goes Linux, I'll probably be using Linux as my main OS. I already converted my software suite to Free/Open Source Software.

I also perfer Mint these days as the cinnamon desktop is very close to Modern Windows and doesn't force everything to download as snap.

Link to comment
1 hour ago, reepblue said:

Gonna be real. Once Ultra Engine/App Kit goes Linux, I'll probably be using Linux as my main OS. I already converted my software suite to Free/Open Source Software.

I also perfer Mint these days as the cinnamon desktop is very close to Modern Windows and doesn't force everything to download as snap.

This. My current new job will require usage of Linux at some point. It is a lot easier to get all the "stuff" for your environment unlike windows.

Link to comment

The mention of Code::Blocks on Linux triggered my fight or flight response. Horrible times with that in college. That was on 16.04 though; looks like Linux/Ubuntu has developed pretty well in the meantime. If we get Ultra Engine on Linux, could be fun to try and dual boot and develop for cross platform.

Link to comment

Okay, I have seen enough that I think this can be accomplished in a short period of time. There are some questions about the asynchronous nature of Xorg and whether popup windows will be fully supported, but it look like the main challenges have been solved.

497981623_Screenshotfrom2021-05-1607-08-52.png.6b42bc5fe47d49bbb8eb63d85f34e4c7.png

  • Like 2
Link to comment

Having used both Hyper-V, VirtualBox, and VMWare for a while now, I definitely recommend VMWare over anything else. Setup is easier and it has working copy and paste between machines.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...