Game Jam 2019 Recap

So this year was my first game jam! First off, thanks to Pipeworks for providing the venue! This was a great spot to do the event and I’m looking forward to future jams! The event gathered 50+ developers ranging in skills between programming, audio, graphics and system design.  Participants registered and received a name badge that had a sticker to represent each of their chosen specialties.  I snagged a red dot for programming! (Huge surprise right?)

Ted Carter a developer from Pipeworks went out of his way to make everyone feel comfortable in the space. There was a good mix of introvert/extrovert and I feel like he bridged the gap well!  A welcomed appearance by local tech community leader Mark Davis  brought some awesome catering from Baja Express! (Thanks!) Also Thanks to Nikole Gipps for dishing out the Badgr Badges for the Game Jam!

 

 

But what about all the games? Heres the link! https://globalgamejam.org/2019/jam-sites/igda-eugene/games  There were 13 different games created at the Jam.  There were also some great multiplayer concepts that I had not run across before. There were a couple of 2 player games, where the two players had to complete an objective like to meet up with eachother or a common place.  As the players got close to each other the field of view would increase! Very Cool!

 

What did I do? My team decided to make a game in HTML5 canvas JS using webpack. Source code @ https://github.com/bobby5892/InterstellarHomeRunDerby  and if you want to test your skill its available for play at https://eugeneprogramming.com/gamejam.


Good fun!

First View Flutter – Quest for Hello World

Flutter is a new cross platform language allowing you to release IOS/Android apps.

I hit up the download page at https://flutter.io/docs/get-started/install/windows and downloaded the flutter_windows_v1.0.0-stable.zip.

I moved it to C:\flutter



Ran “flutter_console.bat” as Administrator


Ran “flutter doctor” and it looks like i was missing some things.

So first I decided to add flutter into my environment path for windows (windows 10)

Open Control Panel -> all Control Panel Items -> system -> advanced system settings -> Environment Variables

Then select Path and edit.


Then New and type C:\flutter\bin


Hit ok to save.

Now when I open a new command prompt window I should be able to run flutter from anywhere.

Cool so that part works!


Ok so now that its installed and added to path, I decided to fix those “flutter doctor warnings/errors”.


Ran flutter doctor –android-licenses and spammed Y for yes like 5x.


Then in android studio when you open it I clicked the gear at the bottom labeled configure and plugins typed “flutter” and then search in repositories.


Clicked Install – it installed real quick … Restart android studio and then do

it again but type “dart” in the box and installed that as well. It restarted android studio. (don’t do both at once – otherwise it just does the second one)

I then went back to command prompt to run the flutter doctor again to see if i had resolved everything.


So great! I feel like i’m really ready to start the hello world.

so then I did “flutter create hello_world” and it created a directory and some starting files.


In android studio I went to open the project. It had a cool little icon for the project folder.

When it opened it had some pre code there – so I changed it to say Hello World

When i went to build/run it said “No connected devices found; This makes sense why I saw that when the flutter doctor ran!

I went to https://flutter.io/docs/get-started/install and after reading it found out there was nothing i needed to install.

I then found I had to goto Tools -> AVD (Android Virtual Device Manager and download an android device SDK



I hit the download link. It was 750mb.

Once it finished downloding i was able to run it




When I ran the flutter doctor – it showed all 4 as green checkmarks! I figured I was ready to build/run! So i hit build!

Oh sweet success!

LXD and Maya: Adventures in Containerization

I’m sure there are quite a few people out there who are in the same boat I am — You need to run Maya on Linux, but Autodesk only supports RHEL and Centos. For those of us who are running those distros, this is not an issue. For the rest of us, it’s a big pain in the butt.

Now there are several ways to address this problem. You can install RHEL/Centos on a dedicated machine. You can dual boot. You can setup a virtual machine. Or you can try jury-rigging your OS and Maya to work together. For brevity’s sake, I’ll just say that none of those options were appealing to me. No, I instead took the road less traveled.

Maya can run quite well in a LXD container. The only limitation I have yet to overcome is enabling GPU acceleration for Nvidia cards. I haven’t tried setting up audio. The one error I’ve encountered is “Failed to apply color management settings on file open: Failed to finalize the color transform.”

Setup

First off you need LXD and Xpra[1] installed on the host system. If you are running a variant of the latest Ubuntu LTS then all you have to do is apt install lxd xpra.

Now that LXD is installed we need to create our container:

lxc init image:centos/7 maya

Now we map the uid and gid in the container to the host:

printf "lxd:$(id -u):1\nroot:$(id -u):1\n" | sudo tee -a /etc/subuid
printf "lxd:$(id -g):1\nroot:$(id -g):1\n" | sudo tee -a /etc/subgid
sudo systemctl restart lxd
printf "uid $(id -u) 1000\ngid $(id -g) 1000" | lxc config set maya raw.idmap -

So we can mount directories inside the container:

lxc config device add maya user disk source=/home/user path=/mnt/user # Replace 'user' with the home directory you want to share

And that’s it setup. Now we install Maya.

Installation

First we need to start our container:

lxc start maya

Second we need to open a shell:

lxc exec maya bash

Now that we’re inside our container we can start the installation. First let’s get the latest version of Xpra:

rpm --import https://xpra.org/gpg.asc
cd /etc/yum.repos.d/
curl -O https://xpra.org/repos/CentOS/xpra.repo

And then we run:

yum update

And now we can install all of our dependencies:

yum install openssh-server tcsh xterm xpra mesa-libGLw mesa-libGLU libXp libXpm \
libXmu libXt libXi libXext libX11 libXinerama libXau libxcb libXcomposite gamin \
audiofile audiofile-devel e2fsprogs-libs glibc zlib libSM libICE openssl098e \
tcsh pulseaudio-libs libxslt alsa-lib xorg-x11-fonts-ISO8859-1-100dpi \
xorg-x11-fonts-ISO8859-1-75dpi liberation-mono-fonts liberation-fonts-common \
liberation-sans-fonts liberation-serif-fonts libpng12 libtiff

Now we symlink libtiff from the current version to one Maya expects:

cd /usr/lib64
ln -s libtiff.so.5 libtiff.so.3

Before we leave the shell, we need to start ssh and set a password for root (don’t worry, it’s only temporary):

systemctl start sshd
password root # It will prompt you for a password

Now let’s exit:

exit

Now that your back in your host’s shell let’s start xterm to install Maya.

First we need to get your containers IP address:

lxc list

Using that IP, let’s start xterm:

xpra start ssh:[email protected]10.78.68.79:100 --start-child=xterm --exit-with-children --exit-with-client=yes

Xpra will complain about running as root, but you can ignore it for now.

Inside of xterm navigate to the location of your Maya tarball:

cd /mnt/user/path # Replace path with your location

Let’s extract it to tmp:

tar -xvf Autodesk_Maya_2017_EN_JP_ZH_Linux_64bit.tgz -C /tmp/

Now we can run setup:

cd /tmp # Setup will fail if not started from /tmp
./setup

Now that you’re done installing Maya, let’s cleanup:

passwd root -d

And create a user for Maya to use:

useradd user # Replace with your user
passwd user

Finally you can close xterm.

From your host shell you can add an ssh key for password-less login:

ssh-copy-id user@10.78.68.79

Now you can connect to Maya:

xpra start ssh:[email protected]10.78.68.79:100 --start-child=maya --exit-with-children --exit-with-client=yes

There you go! Maya inside an LXD container. I’ll update this post as I figure out more.


References:

[1]: I chose to use Xpra instead of plain X-forwarding because it simplifies host side configuration and improves container isolation

.Net Core on Linux

Host ASP.NET Core on Linux with Apache

Server Config
# install apache / bind

yum install bind httpd

# create link to Maria DB Repository

vi /etc/yum.repos.d/MariaDB.repo

#paste this in

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

#install it

yum install mariadb

#add .net core feed

rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm

#update all existing packages

yum update

#install .net core 2.2

yum install dotnet-sdk-2.2 -y

#add a user for asp projects

adduser asp-dev
Passwd asp-dev

#add user to wheel adds su priv

usermod -aG wheel asp-dev

#switch to asp-dev user

su asp-dev

#goto home folder

cd ~

#make aspTest project

dotnet new console -o aspTest
cd aspTest

#create Program.cs

vi program.cs

Then paste

using System;

namespace myApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

Type :wq to save
Then test it with

dotnet run

Should look like

#switch back to root

su root

#start mariadb

service mariadb start

#force mariadb to start each time the system boots

systemctl start mariadb

#start named (DNS)

service named start
system start named

#create Zones folder for DNS

mkdir /etc/named/zones

#create zone for eugeneprogramming

vi /etc/named/zones/eugeneprogramming.com

Paste

; BIND db file for eugeneprogramming.com

$TTL 86400

@       IN      SOA     lee.ns.cloudflare.com.      hostmaster.eugeneprogramming.com. (
                        2019011901	; serial number YYMMDDNN
                        28800           ; Refresh
                        7200            ; Retry
                        864000          ; Expire
                        86400           ; Min TTL
			)

                NS      lee.ns.cloudflare.com. 
                NS      amanda.ns.cloudflare.com. 

                MX      10 mail.eugeneprogramming.com.
                MX      20 mail.eugeneprogramming.com.


$ORIGIN eugeneprogramming.com.

Then :wq to save

#edit named.conf to include zone

vi /etc/named.conf

#Add to end

zone "eugeneprogramming.com" IN {
        type master;
        notify no;
        file "/etc/named/zones/eugeneprogramming.com";
};

#Create public_html folder

mkdir -p /var/www/eugeneprogramming.com/public_html
chown -R eugenep:eugenep /var/www/eugeneprogramming.com/public_html
chmod -R 755 /var/www

#create apache sites-available

mkdir /etc/httpd/sites-available
mkdir /etc/httpd/sites-enabled

#edit apache config

vi /etc/httpd/conf/httpd.conf

#add to end

IncludeOptional sites-enabled/*.conf

#link it to enabled

ln -s /etc/httpd/sites-available/eugeneprogramming.com.conf /etc/httpd/sites-enabled/eugeneprogramming.com.conf

#make ssl folder

Mkdir /var/www/eugeneprogramming.com/ssl

#generated origin SSL cert in cloudflare PEM Format

#Create a .crt file and a .key file from cloudflare and save it in ssl folder

#Then in the vhosts

SSLEngine      on
SSLCertificateFile        /path/to/your_domain_name.crt
SSLCertificateKeyFile     /path/to/your_private.key 

#edit your vhost and add it all in

vi /etc/httpd/sites-available/eugeneprogramming.com.conf

#at the end of everything it will looklike

So part of this is a reverse proxy that passes the local application running on port 5001 to an apache subdomain.

#create Maria DB and user

Type MYSQL and a terminal prompt shows
create database eugenepr default character set utf8 default collate utf8_bin;

This is an admin user with access to all databases

CREATE USER 'bar'@'%' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON *.* TO 'bar'@'%' ;

You can limit to a database like eugenepr

GRANT ALL PRIVILEGES ON eugenepr.* TO 'bar'@'%' ;

#I like phpmyadmin so i added that

rpm -iUvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install phpmyadmin
vim /etc/httpd/conf.d/phpMyAdmin.conf

#Add your ip to allowed
#also add your connection settings

Application Specific Changes
In your ASP Core project install Pomelo.EntityFrameworkCore.MySql Nuget package. I did version 2.1.4.

Then in your startup.cs

 // Msql 
 // services.AddDbContext(options => options.UseSqlServer(Configuration["ConnectionStrings:Local"]));

Change To

 // Maria DB
      services.AddDbContext(options => options.UseMySql(Configuration["ConnectionStrings:Local"]));

Then your appsettings.json connectoin string is going to change to be

"Local": "Server=127.0.0.1;Database=YOURDATABASE;User Id=YOURUSER;Password=YOURPASSWORD"

Creating a Service of your App

In order for your app to run all the time you need to create a service

vi /etc/systemd/system/lab2.service

Put this in and save

[Unit]
Description=Lab 2 for CS296

[Service]
WorkingDirectory=/var/www/eugeneprogramming.com/cs296/lab2
ExecStart=/usr/bin/dotnet run /var/www/eugeneprogramming.com/cs296/lab2
ExecStop=/usr/bin/pgrep dotnet-cs296-lab2
Restart=always
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-cs296-lab2
User=eugenep
Environment=ASPNETCORE_ENVIRONMENT=Production

[Install]
WantedBy=multi-user.target

Now you should be able to

service lab2 start

And just so its the default for the system to start the service on boot

systemctl start lab2

If all is well you should be able to access your .net core app via apache reverse proxy 🙂