Monday, January 15, 2018

Quake2 on Linux by compiling Yamagi Quake

On my previous post, I talked about using game-data-packager to install Quake2... but what if you want to do it from scratch?

This blog post is basically a distillation of the Yamagi Quake Readme.md, but I hope that it'll help.

  1. Download Yamagi Quake2 7.10
  2. Download q2-3.20-x86-full-ctf.exe patch
  3. Use Wine to extract the 3.20 patch to an empty directory, say, "quake2"
  4. Extract Yamagi Quake2 7.10 to the "quake2/" directory (above)
  5. Make a temp directory, say, "yamagi make files"
  6. Go into "yamagi make files" directory
  7. Clone repository:  git clone https://github.com/yquake2/yquake2.git
  8. Install Dependencies:  apt-get install build-essential libgl1-mesa-dev libsdl2-dev libogg-dev libvorbis-dev libopenal-dev zlib1g-dev
  9. Build it: type "make"
  10. Copy everything from the "release" folder into your "quake2" folder (step 3)
  11. Copy "pak0.pak" and "videos/" folder from a full version of the game to "quake2/baseq2" folder
  12. Start fragging:  Type "./quake2" in your quake2 folder
References:
https://www.yamagi.org/quake2/

Quake2 on Linux Mint [Jan 2018]

Background:  I have an early-2008 model Macbook Pro (MPB) and I wasted most of an entire extended weekend trying to put OS X El Capitan on (or something close to it) with little success.  The closest I could get was OS X Mavericks but then I got greedy and tried upgrading to El Capitan again...to no avail.

Fast-forward to this weekend and I decided to give up and just put Linux Mint 18.3 on it.  I've also gotten into a nostalgic period (maybe it's the winter), but I decided to started playing my old FPS games like Quake II and Quake I, and I thought, why don't I do this on my laptop?  It can certainly handle the game.

I'm writing this blog because this is definitely not the 1st time I've installed Quake2 on Linux... in fact, it's like the 1st time every time.

1st (Video):  Make sure you have the nVidia drivers enabled.  These can be found in:
Administration ---> Driver Manager
2nd (Wireless for MBP): I have a MacBook Pro, Early-2008 model, so I needed to enable my wireless drivers... it's a Broadcom (BCM4321), which Linux Mint detected, so I had to just enable this in "Driver Manager" again.  I'm currently just using Ethernet cable because it's faster, but the cable gets in the way.

Quake II

From what I understand (I may be mistaken), Linux Mint ships with the Yamagi Quake engine (search for it), which is what we're going to take advantage of here.

Check out my other post if you want to use Yamagi Quake from scratch


Install game-data-packager:  Get this from
Administration ---> Software Manager ---> Search "quake" ---> Select "Quake 2"
From what I understand, this program makes .deb packages to install the games; however, you'll need a full install of Quake II to access the data.

*game-data-packager will install your games in /usr/share/games/

 Package the game:  This took me some time to figure out.  To make a proper .deb install file, you need to point game-data-packager to a full copy of Quake2.  You have a couple options here:
  1. Use Wine to install Quake2 from Steam (install Windows .exe for Steam) so you can grab the files
  2. Grab your Quake2 folder from another machine
I picked choice 2, but either way you just need the path.  From your home directory (or wherever you want the .deb file to land) type this:
$ game-data-packager quake2 --package quake2-full-data /path/to/quake2
 *Note, if you just want the DEMO (which will auto-download):
$ game-data-packager quake2
Install the .deb file:  I simply double-clicked it in my window manager

Start Fragging:  Either type "quake2" in the console or find it under "Games" in your Start Menu 

End notes:
Yamagi Quake: There are other ways to do this, but I found this the easiest.  If you don't have Yamagi Quake, you can go here:
https://www.yamagi.org/quake2/


Set your screen resolution:  I'm on a MPB, 17" so I had to change the in-game settings for Quake2 to "fullscreen" and "1400x900", as that's my native resolution for this laptop.

Hope this helps.


Saturday, February 18, 2017

Linux Mint 18.1 + PIA + OpenVPN + Network Manager Gnome [works]

I finally got Linux Mint 18.1 to correctly use OpenVPN with Private Internet Access (PIA).

Here's what didn't work:
  • The PIA supplied binary.  It installed fine, but would simply time out on any connection
  • Using command-line openvpn... even the /etc/openvpn solutions wouldn't work.
My biggest problem was this: OpenVPN would connect (sometimes), but there wouldn't be any internet connection.  I saw solutions that played with firewalls and iptables, but my Android worked just fine, and I felt like I shouldn't have to mess with iptables, NAT, etc.

Here's what did work:
  • Use "Preferences --> Network" and NOT "Preferences --> Network Connections" or Network Manager that's accessed via the tray
  • Download the default ovpn files and unzip:  https://www.privateinternetaccess.com/openvpn/openvpn.zip
  • Goto "Preferences --> Network"
  • Click "+"  --> "VPN"  --> "Import from file" --> select your ovpn file (i.e., "US East.ovpn")
  • Under "Gateway" delete the " :1198" (or whatever port is listed)
  • Enter your PIA username  ("Type" should already be "Password")
  • Click "Advanced"
  • Enable "Custom Gateway Port" and enter the port# you deleted from the Gateway name (i.e. 1198)
  • Click "Security" tab
  • Select "AES-128-CBC" (even if it's already listed)
  • Select "SHA-1" (even if it's already listed)
  • Click "OK" to close Advanced screen
  • Click "Save"
  • Now in the "Network" screen (NOT from the tray), select your VPN and turn it on.  It'll probably ask you for your password, and a popup will say you connected successfully.
  • Test your VPN by visiting here: https://www.privateinternetaccess.com/pages/whats-my-ip/
Auto-connect to VPN

I haven't tried this yet, but in the "Preferences --> Network Connections" dialog (i.e., the other one not used above), you select your wifi connection --> "Edit" --> "General" tab.  There's an option there to automatically connect to a specific VPN when you connect to your wifi.


Hope this helps!

Sunday, February 5, 2017

Getting an iPod 3G Nano (and others) to work in Linux

After none of the music apps that I installed correctly detected my 3G iPod, I decided to poke around and try to do it myself.  I tried using ifuse, etc. using this article as a guide:

http://geeknizer.com/sync-iphone-linux/

But it would only mount my iPod in read-only.  so then I tried mounting it manually but I didn't know what device it was, so over on Stack Overflow I found this command:

sudo lsblk -io NAME,TYPE,SIZE,MOUNTPOINT,FSTYPE,MODEL

And figured out my iPod was on /dev/sdd1

I then created a folder in /mnt

sudo mkdir /mnt/ipod

...then mounted it:

sudo mount -rw -o uid=1000 /dev/sdd1 /mnt/ipod

-rw is for read-write access, and I threw in -o uid=1000 to ensure that it's mounted for the currently logged in user.  My uid happened to be 1000, but you can find yours by typing:

id -u <your_username_here>

I then used gtkpod to manage my iPod.  It's not user-friendly so I followed this guide:

https://www.howtoforge.com/linux_gtkpod_ipod

TLDR for link above:  create a new repository (point it to /mnt/ipod, tell it what model ipod you have, name it), then sync it off the main screen.  you should see your files now.

Wednesday, May 28, 2014

jQuery AJAX - Purposefully POST no parameters using JSON contentType

My issue: Purposefully execute a .NET WebMethod via POST without passing it parameters.  I use $.ajaxSetup to configure my page's calls, so I'm assuming this is where my snag came up, but I didn't want to have to work around this and make my $.ajax() calls more verbose.

Simple answer: encode an empty JSON object, and it won't be passed to the WebMethod when contentType is JSON.


Visual Studio and Javascript Intellisense

I don't know why I didn't track this down earlier, but as I was coding some jQuery AJAX today, I thought to myself, why isn't there Intellisense for jQuery? I mean, MS supports a whole plethora of other items, including Python, so why not js? Well it seems I just didn't do a quick Google search to find out about the ~/Scripts/_references.js file.

_references.js

It's really simple, you just add references to your js files in this folder of the format:

/// <reference path="jquery-1.10.1.js" />

And voila, I have intellisense.  And if you're really lazy you can simply 
  • right-click this file --> 
    • "Auto-sync Javascript references"
    • "Update Javaascript references"
And anytime you add or remove a file, this reference is updated.

Sources:
http://madskristensen.net/post/the-story-behind-_referencesjs
http://www.asp.net/visual-studio/overview/2012/visual-studio-2012-javascript-editor

Tuesday, May 20, 2014

Python-like loops in C#

I just stumbled across this today as I was looking to use Enumerable.Range():

You can use Enumerable.Range(start, end), close to Python's own Range function.  For instance this should look familiar:

C#

Python