Author Archives: davexunit

The Liberated Pixel Cup! – Dev Blog 2

It’s been a slow start, but hopefully things will start to move a bit faster. I am on vacation for the week and I have managed to get some work done.

I spent several days trying to figure out the best way to represent Actors on the world maps where the player can walk around. The Actors walk one tile at a time, fitting to the grid, rather than having “free” movement where Actors can move by any increment. It is much easier to implement free movement (which is what I’ve done in the past) than tile movement. I re-wrote the code that handles all of this several times before I found an implementation that was clean and functional enough.

In this screenshot there are several randomly spawned Actors that have walked to random places on the map. They do this by using the A* pathfinding algorithm I talked about in the previous post. There is an Action class that actually performs the walking animation. This Action is smart enough to re-route upon collision with another Actor.

The player can touch/click on a map tile to walk a path to it. For desktop users or certain Android devices, the D-pad can also be used to move the player around on a tile-by-tile basis.

I have also started work on an interaction and dialog system. In the screenshot, the text box shown is a result of the player interacting with the sign on the building. Right now the text box only displays one string of text, multiple strings and maybe even branching dialog paths still need to be done. Item chests are on the to-do list as well. Hopefully I can get them done soon.

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.

The Liberated Pixel Cup! – Dev Blog 1

Image

The time is finally upon us. The art portion of the Liberated Pixel Cup has reached its deadline, which means that the programming portion of the contest has begun! The competition is a month long in which us code monkeys need to use the art assets that were generated to make the best possible game that we can. Since this pixel cup is “liberated”, all of the source code will be available under the GPLv3.

I am working with someone that I only through IRC (#liberatedpixelcup on Freenode) with the nickname of fr33mind. We will be making a Pokemon inspired game where you control monsters to use in combat. The actual gameplay details will get fleshed out more as the competition goes forward.

We are using libGDX to make the game. LibGDX is a fantastic Java library that allows us to write a game that runs on the desktop (GNU/Linux, Mac, Windows) and on Android devices with very little platform specific code.

Above is a screenshot of my experiments with libGDX. Here you see a path of ghosts that was generated by my implementation of the A* pathfinding algorithm. It took a long time to wrap my head around it but it is a crucial element to the game considering that users will move across the map not only with arrow keys, but by touching/clicking areas on the map (my Android phone has no D-pad). This makes decent pathfinding a must have so I wanted to try to get it out of the way early. The code performs well on the desktop but for some reason takes about 3 seconds to run on my Android phone, which is a serious problem. My choice of data structures or too much memory allocation could be the problem and I need to investigate who the culprit is. I’m using a PriorityQueue and a HashMap to maintain lists, and a Pool (in libGDX) to minimize memory allocation, yet the problem persists.

I’m going to try to keep this development blog going over the course of the month with screenshot updates. Let’s see if I can manage to actually do that.

UPDATE:
Turns out the performance problem was because of how I was drawing the path on screen and NOT the algorithm itself. I have since abstracted away the things that are dependent upon a specific tile map implementation and have a rather generic set of classes to use for pathfinding.

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.

Life Updates

I haven’t posted here in awhile and I would like to attempt to blog every now and then. I don’t know if anyone in the CS department besides the fabulous Karl Wurst reads the WSU CS planet feed, but if any of you undergrads are reading this: good for you. I like you.

Now that I have graduated (yay!): What’s next? I’m still working as an intern at Cyberonic but I think it is time to move on. I have gotten a resume together finally and posted it on Monster and Indeed yesterday and on my way into work today I got a call from a man who had 4 job offers for me. Not bad for one day, eh? A lot of the job opportunities that I have been seeing are for web developers, particularly Ruby on Rails developers. Now, I have dabbled with Ruby on Rails in the past but I don’t know much about Rails or Ruby. I’ve always been a Python guy. So, if you’re an undergrad reading this: LEARN RUBY. DO IT NOW. A lot of programming jobs in Massachusetts are in Boston so I need to try to move east a bit and close to the highway to ease my potential commute to work.

I have started to contribute to some FOSS projects finally. I am starting to become involved in the GNU MediaGoblin and GNU FM/Libre.fm communities. They are both free as in freedom web applications that I want to see mature in order to bring more free culture to the web. MediaGoblin is a YouTube/Flickr/SoundCloud/etc. replacement for hosting different types of media files and it is AWESOME. GNU FM is a last.fm replacement for streaming music and “scrobbling” your played tracks to your online profile. Currently the main GNU FM instance is Libre.fm, featuring lots of freely licensed music to stream. Both services have a goal of becoming “federated”, meaning to have a distributed network of instances that talk to each other. I have a vision of glueing the two services together somehow to make a free as in freedom service for musicians (such as myself) to share their music, pictures, videos, podcasts while giving regular users a place to follow the musicians and scrobble their listening habits. Maybe someday.

I’m also getting involved with Liberated Pixel Cup. A game development competition with the goal of making more freely licensed games and artwork. Many thanks to Creative Commons, OpenGameArt.org, and the Free Software Foundation for making this all happen. The art competition is taking place this month and the programming competition begins in July. First prize is $1500 and second prize is $500. I’m hoping that I can make a fun game and just maybe win some prize money if I am lucky.

Finally, my punk rock band, Get the Fear, has been doing well. We’re playing some very cool shows and are writing more original material in hopes to record a full length album before the year’s end.

All in all, things are going well. That said, I can’t wait to take a week off from all of this work in July when I go to Maine.

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.

CS401 – We Have Liftoff! (and other news)

Took long enough, but we now have a working cloud!!! It’s been a real struggle to learn the proper way to configure and install things to get the whole system to work properly. Applying what I learned from Andy Grimm and taking his advice to install Eucalyptus 3 via packages rather than building from source, I was able to start fresh and have a functioning cloud in a little over an hour. I was filled with joy when a classmate succesfully launched a VM instance and logged into it via SSH.

Too bad that the semester is nearly over now. Oh well. I need to finish up my documentation for how a newbie can create a Eucalyptus cloud. I was really hoping to get into some source code before the semester was over but that is just not going to happen. Even though I haven’t written a line of code this semester, the course has been invaluable. I am now far more comfortable interacting with software developers via IRC. I have learned a good deal about Linux system administration through failing over and over again. I still hate writing documentation, but now I have gotten a little practice at least. 😉

Hopefully I can wrap up my documentation project soon and get working on the final assignments for the course: an ethical analysis of Eucalyptus and a slideshow presentation about the work I did over the semester.

In other news, the WSU programming team (of which I am a part of) got 4th place out of 27 at the competition held at Quinnipiac University! We solved 4 (nearly 5) out of the 6 problems. I wasn’t expecting such a high so it came as a pleasant surprise to see that we got 4th. This was my last year on the team so I’m glad we performed well for my final competition.

Oh, before I forget: after this semester is over… I’m done with undergrad! Which means I need to find work, preferably developing FOSS. Just need to finish my resume. So, who wants to offer me a job? 🙂

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.

CS 401 – Quality Time with Andy Grimm

On Thursday, the 19th, Eucalyptus developer Andy Grimm paid WSU a visit. Other students and I ate lunch with him and our department chair Karl Wurst. Our lunch bill is being paid by Red Hat, so even if I never work there and get a pay check from them, I can at least say that I had lunch on them one time. 😉

After lunch, Andy and I spent the next 3 hours trying to resolve the various issues that were keeping our cloud from functioning properly. The good news is that I learned a lot about how Eucalyptus works, networking, and some neat command line tricks. The bad news is that our cloud is still not functioning.

As I pointed out in my last post: networking is hard. It is especially hard when working on the university network whose topology is pretty much unknown to me. The first big mistake that I made when I set up the network for the cloud was split the LAN into 2 subnets. The CLC, SC, and CC were on one subnet, while all the NCs were on their own subnet and the CC acted as a router for them. I had misread some networking documentation and mistakenly thought that having the NCs are on their own subnet would make things easier for later on. Andy set me straight about that and I “flattened” the network out so all of the NCs are now on the same subnet as the other Eucalyptus components. Next, we set up ethernet bridges for virtual networks that will be needed for the virtual machines. That was mostly straightforward but through some slight misconfiguration I encountered Red Hat networking hell involving a renamed `eth0` which Andy resolved for me by messing with udev.

I thought that I had a recent enough kernel installed on all of the machines to avoid the kernel bug that breaks Walrus. Turns out I didn’t. So no matter what we did the cloud would never function until that was resolved. A `yum update kernel` and a reboot took care of that. Then, for some strange reason, PostgreSQL processes wouldn’t start. Andy started them manually and things seemed to work just fine for subsequent reboots.

Despite fixing all of these issues and making a ton of progress in such a short time, we were still unable to run a VM instance. Andy and I ran out of time (he had a train to catch and I had to return to work) but he suggested that I essentially start over once again. This time I will be using the Eucalyptus packages that are available from the Eucalyptus repository.

So, another week goes by without a working cloud… but I learned a lot. Many thanks to Andy Grimm for making me a better system administrator.

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.

CS 401 – Networking is Difficult

So I haven’t posted here in awhile. In CS 401 I have been trying unsuccessfully to create a working Eucalyptus cloud. At this point the basic system is in place: The core services are running. Users can sign up for an account on our cloud. Users can upload kernels and OS images. However, when a user tries to launch a virtual machine instance everything falls apart. The instances are forever stuck in the “pending” state.

I was using the “managed” networking mode for Eucalyptus. However, upon testing if the network was “VLAN clean.” I followed the instructions here and alas, the VLAN was not clean. It seems like more of a headache to get the VLAN to function than it is to switch to the “managed-novlan” networking mode.

The “managed-novlan” mode required me to manually configure an ethernet bridge for Eucalyptus to use. I followed the instructions in the Eucalyptus 3.0 Installation Guide and everything seems to work (running `service network restart` shows no errors), but now the Cluster Controller cannot communicate with the Node Controllers. This means that there are no available resources advertised for VMs. So now I cannot even try to start up a VM instance. 🙁

I only have basic networking knowledge so these issues have been a real headache for me. The fine folks on the #eucalyptus IRC channel have been helping me out with everything but everytime we eliminate an issue there is another one to take its place.

In other news, Eucalyptus project member Andy Grimm will be visiting WSU this week. I’m looking forward to talking with him and hopefully I can convince him to give me some on-site assistance with the servers.

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.

Tutorial – Installing GNU FM

I recently heard about a neat little site called libre.fm that provides a last.fm like service for listening to and sharing your musical interests. Libre.fm, however, runs on free software, respects user privacy, and includes only freely licensed music. The software that powers libre.fm is called GNU FM. I installed it on my home server just to check it out. This post explains what I had to do to get a working installation. The GNU/Linux distribution that I am using is Debian Squeeze. Hopefully this guide can be of help to someone.

Prerequisites

This guide makes the assumption that you already have a functional web server (Apache, nginx, etc.), PHP 5, and database server (either MySQL or PostgreSQL).

Setup Database

I made a MySQL user specifically for GNU FM

CREATE USER 'gnufm'@'localhost' IDENITIFIED BY 'yourpassword';

Create a database

CREATE DATABASE gnufm;

Download Source

GNU FM uses Git for version control. The source is available from gitorious. Clone the repository with the following command.

git clone git://gitorious.org/foocorp/gnu-fm.git

Install Gnukebox

From the gnu-fm directory, copy the server application, gnukebox, to the web server directory.

cp -r gnukebox/ /var/www/

From your web browser, go to http://yourwebserver/gnukebox/install.php. It’s quite straight forward. Enter the information in for your database server like the database name and the user that you have created.

If the web server cannot write to the directory in which you installed gnukebox, you will see a page that prints out the configuration code that you will need to manually insert into the config.php file in the gnukebox directory.

Install Nixtape

From the gnu-fm directory, copy the web interface, nixtape, to the web server directory.

cp -r nixtape/ /var/www/

From your web browser, go to http://yourwebserver/nixtape/install.php. You will enter the same database details as you did for gnukebox and give your GNU FM server a name.

Once again, if the web server cannot write to the directory in which you installed nixtape, you will see a page that prints out the configuration code that you will need to manually insert into the config.php file in the nixtape directory.

Nixtape requires some extra PHP libraries to be installed along with it. Please note that the version numbers of these libraries may be different depending on how far you in the future you are coming from. Which means that copy/paste’ing the commands I give you will not work, but you’ll probably only have to change the version number in the command to make it work.

Install ADOdb

ADOdb is a database abstraction library for PHP. Installing the library takes just a simple apt-get.

apt-get install php5-adodb libphp-adodb

Install Smarty

Smarty is a PHP templating library that nixtape uses for all web pages. There are packages available in the Debian Squeeze repository, but GNU FM does not work with them. The problem is the result of a slightly different path to the files contained in the Debian package. Since the GNU FM repo has a .tar.gz archive of Smarty within it, we’ll just install that instead.

From the gnu-fm directory, cd to the external_dependencies directory.

Extract Smarty and the Smarty text plugin.

tar zxf Smarty-2.6.22.tar.gz
tar zxf smarty-gettext-1.0b1.tgz

Copy the needed files to the nixtape directory.

mkdir /var/www/nixtape/smarty
cp -r Smarty-2.6.22/libs/ /var/www/nixtape/smarty
cp smarty-gettext-1.0b1/block.t.php /var/www/nixtape/smarty/plugins

Create a templates_c directory for compiled templates and make it writeable by the web server user.

mkdir /var/www/nixtape/themes/gnufm/templates_c
chgrp www-data /var/www/nixtape/themes/gnufm/templates_c
chmod 775 /var/www/nixtape/themes/gnufm/templates_c

Profit!

At this point I was able to have a working GNU FM installation. There are still plenty of things left to do such as add music, add a new theme, etc. Maybe once I get around to doing those things I will make a follow-up tutorial. Anywho, I hope this has been of some use to you folks out there in Internet land. Still having a hard time setting up GNU FM? If so, head on over to #libre.fm on irc.freenode.net and ask the developers for help. Oh, and don’t forget to leave a comment if there’s an error or something you would like me to improve in this tutorial. You can also leave a comment and say what a great guy I am. 🙂

Take it easy.

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.

CS 401 – New Computers! Spring Break!

In my last blog post I mentioned that the computers that we were using to run Eucalyptus servers were too old to support hardware virtualization, a feature that we absolutely must have. I thought we were doomed, but luckily the IT department was able to give us 9 computers that are much more recent. The computers aren’t new by any means, but the CPUs are dual core and hardware virtualization is supported so I am quite content with them.

On Friday, Prof. Wurst and I set up several of the computers and installed CentOS 6.2 on them. I have already read and written a lot of documentation about how to compile Eucalyptus from source, so it did not take me very long to get the Eucalyptus services running on the new machines. The services, aside from the NCs, are running for the most part on 3 machines now. We decided that it would be best to let the Walrus service have its own server where previously it was on the same server as the CLC. So, the CLC, Walrus, SC, and CC are operational again. I have registered the Walrus, SC, and CC servers (CC and SC are on the same machine, by the way) with the CLC. However, the system is reporting that the SC and Walrus are broken and I have not yet resolved that issue.

In the meantime I decided to set up a couple of NCs, but in trying to set up the ethernet bridge for KVM to use, I managed to lock myself out of one of the servers when I did a `system network restart`. I guess I screwed up the configuration files! It’s not much of an issue because tomorrow I will be going to campus to work in the server room with Mike Iudiciani and I will resolve the issue there.

In doing all of this work, I have found a bug in the `euca_conf` tool. One role of euca_conf is to get credentials for access to the Eucalyptus system via command line. The command line switch for this is –get-credentials. I started the `eucalyptus-cloud` service and tried to get my credentials via euca_conf. However, I just got a “list index out of range” error printed to my terminal. After waiting for some time, the command worked successfully and I got my credentials. The problem appears to be that the cloud services were not fully functional when I tried to get the credentials, and euca_conf did not properly handle the situation and crashed. I will be filing a bug report about this shortly.

In other news, spring break is this week, but since we are running way behind schedule I will be working on this project a lot over the break. Setting up these servers has proven to be much more difficult than anticipated so I will be spending a lot of time trying to catch up to where we should be and hopefully the result of all of this hard work will be a finally functional Eucalyptus cloud.

 

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.

CS 401 – Tons of Progress… And Yet Another Roadblock

I’ll start with the bad news. On Sunday, March 4th, I tried to SSH into the CLC from home to try to get some more work done. I was greeted with a timeout. Neo, the CLC, was down. It turns out that the CPU fan was dead and the system overheated. We have 8 machines and it was just my luck that the CLC machine had the bad fan. So, either permanently or temporarily, I’m going to be using Morpheus as the CLC. Luckily, I had already rsync’d the Eucalyptus binaries to a few other servers so I could easily continue my work.

As an initial test, I’m using 3 of our servers to make a minimal working configuration. There are a lot of things that have to be done to each machine such as adding repositories, downloading dependencies, initializing PostgreSQL, and finally initializing Eucalyptus. There are 3 init scripts that Eucalyptus provides: eucalyptus-cloud, eucalyptus-cc, and eucalyptus-nc. Walrus, CLC, and SC require eucalyptus-cloud to be running. CC require eucalyptus-cc. Each node requires the eucalyptus-nc service. On the CLC machine, I registered it to be used for Walrus and the SC. We have another server, named Trinity, being used for the CC that needs to be registered with the CLC.

Now that the CLC and CC were operational, it was time to start up a node. This is where I ran into even more trouble. The computers we’re using as servers are older machines with CPUs that do not support hardware virtualization. With the release of RHEL 6, KVM is the supported hypervisor for virtualization. Unfortunately, KVM requires hardware virtualization support in order to function so it is not a possible option for us to use. The Xen hypervisor, on the other hand, doesn’t need to have hardware virtualization in order to function. The problem is that support for it was dropped in RHEL 6 so it is not so trivial to install now. The Xen wiki has a tutorial about installing Xen on a RHEL 6 system, which is quite long. I am slowly working through this tutorial to build the Xen packages that I need. It is an unfortunate situation because it is a very time consuming process. I was really hoping to have this system functional by today so I am a bit disappointed that I once again failed to meet my goals.

To end on a positive note, I am starting to become familiar with the Eucalyptus software. The more I start/restart the services and register/deregister components, the less confused I become about how the Eucalyptus system functions. I have written quite lengthy documentation on the CS401 wiki about all of my progress that another classmate has been using to help setup other machines that will later be used as nodes.

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.

CS 401 – Does Eucalyptus Fail?

My homework assignment (besides continuing my ongoing struggle with installing Eucalyptus) was to take a look at Tom “Spot” Callaway‘s “How to tell if a FLOSS project is doomed to FAIL” and see how many points of fail that the Eucalyptus project has. I had the pleasure of meeting Spot and hearing him give this talk at Western New England College and it was very entertaining.

Now, how badly does Eucalyptus fail? By my calculations they had 55 points of fail which means that “Babies cry when your code is downloaded”. I think I may have been a bit too rough with my analysis. I really do like the Eucalyptus project, but as a new user that is also completely new to the cloud computing concept, it’s hard to figure out exactly what to do and how to do it. There is documentation but there is not enough of it. From my understanding the Eucalyptus team acknowledges that and one of our goals this semester is to improve documentation for users, and who better to write documentation for new users than… new users!

In addition to the documentation fails (I forgive you, Eucalyptus devs, I hate writing documentation as well 😉, as far as I can tell there are no unit tests for the source code to check for bugs that may have creeped in. That alone earned Eucalyptus +25 points of fail and pushed the project into the crying babies category.

Once again, from what I have seen, the Eucalyptus project is great. Their developers have been supportive and responsive when I’ve had issues. As a FOSS advocate, the freedom of using a free and open source cloud computing platform far outweighs the convenience of a proprietary system that is easier for newcomers. Eucalyptus is much more win than fail, and I hope that my class can help the developers improve the usability of the software.

From the blog David Thompson » WSU CS by davexunit and used with permission of the author. All other rights reserved by the author.