Terraria Server with Ubuntu 10.04 LTS (Linux)

Jan 2nd, 2012 Update

TDSM has supposedly decided to shut down. You can still follow the blog post below (mostly) but try using TShock for the server now instead of TDSM. Visit their GitHub downloads page.

First: My two cents on Linux distros…

I’ve recently become somewhat addicted to my new virtual dedicated Linux server. I love Ubuntu because of their outstanding support, vast community, and massive, up-to-date package repo. While we’re talking about distros I have to say that I HATE CENT OS with a deep, burning passion. It’s a horrible, convoluted, out-of-date distro and no one should ever use it. Ever. I’m looking at you, MediaTemple. I really wanted to use your servers, but I refuse to settle for Cent OS.

Headaches, compiling and dependencies (You don’t need them!)

Let’s move on. I did a lot of research into this while trying to get it to run, so here is a little background…

Terraria is written in Microsoft’s .NET framework with XNA. It’s pretty much perfect for Microsoft platforms as .NET and XNA gives a TON of flexibility with Windows, Phones, Xbox, and more. Personally, I love the .NET framework to death. It’s effective, pretty clean, and it gets the job done quickly. There’s tons of other features (anonymous types, LINQ, etc..) that I could gush about, but I’ll skip it for now. Unfortunately, that’s where the fun stops. Once you go .NET you’re effectively vendor locked to Microsoft, or at least you used to be. Enter the Mono project

What is Mono?

Mono is a project lead by Xamarin (formerly by Novell) that is trying to open up the .NET framework so that anyone can use it on any platform.

Cool, so Mono is basically the .NET framework… right?

Well, almost. It’s a constant work in progress playing a massive game of catch-up with the real .NET framework. The real Terraria server doesn’t actually work inside of Mono. My understanding is that the core reason behind this is the XNA framework isn’t readily available inside of Mono. So I went off on a research spree… I tried compiling MonoGame and MonoXNA to work the dependencies into Mono. While we’re talking about them… they should both be horribly, horribly ashamed of the lack of documentation around their build processes. Mostly because there is none. I had to go digging around into the source to figure out that OpenTK is required for MonoGame, and for MonoXNA I stopped caring before I could get very far into the 50+ compile errors it was throwing fresh out of version control.

Well that was a wild goose chase… and lucky for you because compiling all of that junk is confusing, prone to errors and tons of other headaches. After some more research I found that I had missed another solution. Instead of running the stock game files, the wonderful (I haven’t met them, but their software rocks.) person/people over at Terraria Dedicated Server Mod (TDSM) have whipped up a modded server that is actually super powerful in comparison to the stock server. Now you may be thinking, “Hey buddy, don’t mod my server. I like things stock!” But hold on. The mod server seems to run totally stock, but has some extra power and options in the console. It’s even open source on GitHub!

An open, dedicated Terraria server

I finally worked through the whole process and it’s super simple compared to what I thought it was going to be. Here is the culmination of my effort in semi-bash script format, but don’t try to run it, it’s not actually a script. Follow along with my double hash (##) comments to get a firm understanding on what’s going on.

## To start, we'll work inside our home directory.
## You can work elsewhere if you prefer, but this makes permissions easy.
cd ~
 
## First, add BadgerPorts into your sources list
## For more information on BadgerPorts visit http://badgerports.org
sudo nano /etc/apt/sources.list
 
## Add these lines to the end of sources.list (the first line is a comment for your reference!)
# BadgerPorts apt source for Mono
deb http://badgerports.org lucid main
 
## Download and add the GPG key for BadgerPorts
wget http://badgerports.org/directhex.ppa.asc
sudo apt-key add directhex.ppa.asc
 
## Update your apt repo and install the Mono package
## For more information on Mono visit http://mono-project.com
sudo apt-get update
sudo apt-get install mono-devel
 
## Check your Mono version. It needs to be 2.10 or greater.
mono -V
 
## Download the Terraria Dedicated Server Mod (TDSM)
## For more information on TDSM visit http://www.tdsm.org
wget http://update.tdsm.org/Terraria_Server.exe
 
## Move the executable elsewhere if you desire.
## It will generate some files when it is run.
mono Terraria_Server.exe
 
## That's it! Edit the server.properties file to update settings.
## You'll be asked if you want to stop and edit on the first run.

 

Hey, it works! A Terraria server on Ubuntu!


Congratulations! You can keep running unchained from Windows. If you’re looking for an excellent way to manage your servers, I cannot recommend tmux highly enough. It’s excellent for backgrounding tasks that take over the console like Terraria’s server. In addition you can come back later on and run `tmux attach` to get back to your existing sessions. Check it out, and seriously consider reading the manual. It’s a little complicated at first, but it will pay off. Installing tmux in Ubuntu is as easy as `sudo apt-get install tmux` – I seriously love the package manager and repos Ubuntu has.

Posted in Hacks, Linux, PC Games, Programming | Tagged , , , , , , , , | 3 Comments

Test and debug your ASP.NET sites on iPhone, Android, and other mobile devices locally with SharpProxy

Have you ever wanted to test and debug a mobile ASP.NET site on an iPhone, Android phone, Blackberry, or other mobile device? If so, you might have noticed that the development server packaged up by default with Visual Studio is a little bit… limited. It doesn’t allow anyone to access your local development web server, and will actually reject requests from outside your local machine outright.

Maybe this is a good idea for security. Maybe it was a decision made to keep people from using the development servers instead of getting a real IIS server. Maybe it was just easier to program when developing Visual Studio? I am really not sure what the official reason behind it was.

First, let me ask you a few questions about mobile web development issues with ASP.NET that used to be painful for me:

  • Ever had to push a site up to a development server every time you make a change?
  • Tired of waiting FOREVER for sites to publish after changes just so you can test them on your device?
  • Frustrated over not being able to use breakpoints after publishing to a remote server?
  • Sick of resynchronizing data every time you have to push a change to your development server?
  • Ever wished you could share changes from your local machine without overwriting or waiting to republish on development?

I sure hope these are things that make you mad, because they were pissing me off to no end. After doing a few full mobile sites with ASP.NET I could literally take no more. I decided to come up with a solution. Maybe it’s not the best solution, but I needed something that would solve these problems for myself and people on my teams.

I decided to go for a program that would open up the internal local port to another port of my choosing globally. All traffic is passed directly from one port to the other, internally, while being completely loss-less and unchanged. Since it’s written with the .NET framework and I generally call it like it is… I dubbed this project SharpProxy.

SharpProxy does what it can to keep things simple.

Using SharpProxy is easy:

  1. Take a peek at what port your local ASP.NET server has decided to use.
  2. Enter it in as the Internal Port
  3. Change the External Port if desired
  4. Hit Start

Finding your ASP.NET development server's port

That’s it! Once you have SharpProxy up and running, you can connect your device to your internal Wi-Fi network and access the server via IP and port. In my case, the process looks like this:

  1. Configure and start SharpProxy
  2. Connect my iPhone to Wi-Fi
  3. Point Safari to http://192.168.1.103:5000

If I wanted to, I could setup a port forward from my router on port 5000 and use my public IP address or a dynamic DNS service. Hopefully how this all fits together is making sense – I trust you (the developer) are at least partially familiar with network scopes, firewalls and all of that. ;)

Potential Pitfall: I really don’t think this will be a problem for most people. Still, you should be aware of it. This isn’t a problem with SharpProxy, rather it is a problem with redirections in general.

When using this with our CAS authentication server at work, I noticed that sometimes the redirects from our projects were wrong. I corrected for our case by making sure I redirect back from CAS to whatever the requested host was – NOT localhost.

In code, you can detect what the base host is by doing something like this from an ASP.NET MVC site’s controller. I think it should also work from an older ASP.NET web forms project also.

string baseURL = "http://" + this.Request.Headers["Host"];

To conclude, I hope that SharpProxy can be useful for you. I’ve published the source on GitHub, so feel free to get a copy of it, or just download and use the executable (requires the .NET 2.0 framework or greater). It may work in Mono also, but I haven’t tested it.

It’s free as in beer! (That means it’s really free, no license.) If you like using it feel free to talk about, write about it, link to it, or donate a few dollars into my PayPal. I have no shame about asking for that – everybody’s gotta eat!

Download SharpProxy
(Make sure you have the .NET 2.0 framework or greater)

Get the source code on GitHub

Posted in productivity, Programming, Web Programming | 22 Comments

Kalidity – Stream your music anywhere

This past weekend I officially opened up Kalidity, my answer to the streaming media on the web and mobile. This has been something I’ve been working on for several years, and is the result of much experimenting, tweaking, and perfecting. When I started this project, there was very few alternatives that I was aware of. Simplify Media was one of them, but they have since been purchased by Google and shutdown. I recently tried Orb, but found it to be terribly clunky and prone to crashes. Using it was just short of a nightmare. I’ve gone through countless other alternatives and just didn’t like what they had to offer. So I did what needed to be done and built my own from scratch the way I felt it should be, and more truthfully, the way that it needed to be.

For me, music isn’t just for entertainment or casual enjoyment. It completely drives my day and powers me through almost every effort I make. No matter what I am doing, I almost always have music in the background. I love to listen to music while I work, drive, or even while I do the dishes. Music isn’t just a small aspect of my life, it’s a huge part of everything I do.

Problems

So if there are people out there that love music like me, then why is every media player trying to get in my way? Why don’t they put my newest music at the top of my list if I ask for it? Why do they scramble up my artists when my folders are arranged perfectly? Why is it always such a pain to create ad-hoc playlists based on what I want to listen to at that moment? Why don’t they give me the album art automatically? Why don’t they recommend new music to me? Why is searching my library always a terrible experience?

The problems often extended beyond the media player. No one lives life standing still. We all have mobile devices, laptops, desktops, computers at work, computers at school, and more. Taking music everywhere is a real problem, and you could be stuck copying audio everywhere and syncing up your mobile devices every time you get a new song. Don’t even mention the space limits on mobile devices. Anyone with a serious music library won’t be able to fit much of it on a 8GB or even 16GB iPod. So what happens when you’re out and just want to hear that one song… but you couldn’t fit it on your iPod earlier? What if I don’t want to sync my music to 5 different locations every time I get a new song?

Solutions

Kalidity is a music connection service that keeps your music available wherever you go. Kalidity is powered in part by its own small application that you install on your home computer. If your computer is online, your media available. There are no space limits. I also wanted to avoid the legal mishaps (not to mention days/weeks of upload time) that come along with copying music off of your computer to a remote server. With Kalidity there is no uploading files. Everything you make available remains on your computer.

Kalidity Web Interface

Kalidity's Web Interface

Kalidity’s home application works to optimize your media for the web instantly, while supporting a wide variety of common file types. What this means is that there is no more waiting for things to buffer. Audio is converted and streamed on-the-fly with zero waiting time.

Everything in your library is made available in ways that are easy to use. You can access everything through the web interface, or through the mobile website. There’s no applications to download while you’re on-the-go. Simply access everything through whatever browser you have available.

Kalidity aims to get you what you want faster. Listening to music should always be about the music, not stumbling around with the media player trying to find what you’re looking for. Kalidity makes it easy to put what you want in a playlist, and then forget about it. The only reasons to come back to the player are because you’re hearing a great song, or because you decided to skip one. If a song comes on and you’re in the mood to hear more, just click the artist or album name and the interface will search for them instantly.

Searching with Kalidity is fast and accurate

Searching in Kalidity is fast and accurate

Discovering new music based on what you listen to is something that I felt was especially important. I often get asked how I discover new bands. The answer used to be cruising Amazon’s site and listening to samples based on what other customers had purchased. Now music discovery is a feature that is built into Kalidity. I simply open up the “Discover” tab and get recommendations based on what I’m listening to. Instantly. If I decide to, I can click anything that looks interesting and listen to samples on Amazon.

Kalidity's Discover Tab

Kalidity's Discover Tab

The mobile web application was an especially important feature to me. Since purchasing my iPhone, I’ve realized one big flaw in touch devices: using my iPod while driving is hard. By “hard” I mean both difficult and sometimes dangerous. If I had one goal, it was to do what I could to make music listening easier while performing other tasks. Extensive playlist controls and accurate searching make it much easier to setup what you want to listen to, and then put the device away. You can queue up hours of music at a time, which results in a much more hands-free experience than the original iPod application.

Kalidity on an iPhone

Kalidity on an iPhone

So that concludes my short tour of Kalidity (as it is currently). The site is open and you are more than welcome to integrate it into the way you listen to music. I am currently working on making it cross-platform so it will also be available for Mac and Linux. (UPDATE) Kalidity is now available for both Windows and Mac OS. If you have something to say about Kalidity (positive or negative) write me a message and let me know. You can use the community support forums to reach myself and everyone else quickly. I hope you’ll take the time to try Kalidity for yourself. I love using it, and I hope you do as well.

Click here to check out Kalidity now

Posted in Media, Music, Programming, Web Programming | Tagged , , , , , , , , , , | 4 Comments

ToDo Teams now available for use

Divide, conquer, and get stuff done. ToDo Teams is a little project I whipped up for a few reasons.

  1. I found that while splitting tasks up with student developers at work, that we were often stepping on each others toes. We needed a quick and easy way to indicate what we were working on so no one else would be trying to do the same thing.
  2. We needed a centralized place to manage tasks and track things to work on for specific projects.
  3. I wanted to learn CakePHP.

ToDo teams is essentially a productivity free-for-all. There’s no assigning tasks to people or forcing people to work on certain things. There’s simply a list of things that have to get done, and everyone is given the ability to work towards that goal.

…at least that’s how it is now. In the future it could change.

When something on a project changes, other users viewing that project will quickly receive notifications about projects changes through AJAX alerts. This helps to keep everyone up-to-date on the latest project information, and helps keep stale information or concurrency issues from happening.

ToDo Teams Screenshot

ToDo Teams Screenshot

ToDo Teams uses OpenID (currently through Google or Yahoo) so that there’s no extra usernames or passwords to remember. You can be logged in and working in seconds, and there’s no extra headaches keeping team members from joining your project.

ToDo Teams aims to be as simple as possible with the focus on getting stuff done, not fooling around with complicated project management software. If you think ToDo Teams may be a good fit for you and your team, check it out now.

Go to ToDo Teams

Posted in productivity, project management, Web Programming | Tagged , , , , , , , , | Leave a comment

Free Contact Management / Roledex Software for Windows

A few years ago I wrote some contact management / Rolodex software for a friend. I went back to it today and created an installer for it and wanted to release it to the world. Download it now! Interested in the source code? It’s available on GitHub! http://github.com/jocull/ContactManagement

New Contact

New Contact

Main Interface

Main Interface

Detail Sheet

Detail Sheet

Program Options

Program Options

Birthday and Anniversary Alerts

Birthday and Anniversary Alerts

Posted in Programming | Tagged , , , | Leave a comment

Zen Garden Farmer for Plants vs. Zombies – Get fast money from your Zen Garden!

Plants vs. Zombies is a great game. There’s lots to do, even after you beat the main game. There’s new games and puzzles to play, and things to buy. Money actually becomes a large part of the game later on, so having a good way to get money is important.

In my opinion, the Zen Garden is the easiest and most consistent way to get money if you have a decent sized garden. Purchasing Stinky the Snail makes collecting the coins and diamonds easier, but there is one critical problem: he’s narcoleptic. He’ll often take a snooze after just a couple minutes of collecting coins, meaning that you have to sit there and wake him up.

“Not fair!” I say. What if I wanted to take a nap? Can’t we take shifts? Apparently not, according to PopCap. So, I decided I needed something that would wake Stinky up, and along the way a few other features snuck in. Ladies and gentlemen, I give you… Zen Garden Farmer.

Garden Farmer works for you by taking control of the mouse and doing some of the more tedious tasks of taking care of your Zen Garden. Hopefully this video will help explain things.

So, feel like trying it out for yourself? Go ahead and grab it then! Interested in the source code? It’s shared on GitHub! http://github.com/jocull/ZenGardenFarmer

Download Garden Farmer now

and/or…

Join the discussion on the Steam forums

Update: I got bored and decided to add in a Whack-a-Zombie mode. It works for Beghouled Twist too as long as you have matches available. If you run out of matches you can just take over for a second to hit the “shuffle” button, then put it back on cruise control. Video here:

Posted in PC Games, Programming | Tagged , , , , | 33 Comments

“tv2night” Goes Live

I applied for another Twitter account and created a small CRON job for it on my own server. Now you can follow Television Tonight and get tweets about one hour before your favorite shows come on the air.

Tweets (updates) are limited to 140 characters. In the space we have most of the important information. The format is concise, but useful:

[Show Name] s[Season #]e[Episode #] is starting on [Show's Network] in [minutes 'til air time] min! ([Time show starts] EST) Summary: [TinyURL to Episode Summary]

The tweet is measured before and after adding the summary. If the tweet is too long, the word “Summary: ” will be cut. If the entire link won’t fit it isn’t included at all, because having half of a URL doesn’t make much sense.

Interested in following? Check it out now: http://twitter.com/tv2night

Posted in Programming, Web Programming | Tagged , , | Leave a comment

Dawn of War 2 Multiplayer Beta Thoughts

  1. The Requisition is broken.
  2. The Requisition is really broken.
  3. Seriously, please fix the requisition. The game is great, and deserves it.

This game reflects Company of Heroes pretty closely. Much of the game is based on taking cover, positioning, suppressing, and flanking the enemy. Especially suppression is a huge issue to deal with. Suppressed squads move slowly, take more damage, and are basically just dead. The only way to get out of these suppression effects is to get out of fire, die, or run like hell. The game has a “Flee” ability on most units that make them run away to the nearest reinforcement point. It breaks suppression effects and gives a little defensive bonus, I think. Your units are likely to live while fleeing, but they can get blocked off or pulled back by certain abilities.

Unfortunately, right now a big part of the game is also running the hell away from anything that could possibly kill your units. Because the requisition is so broken, any loss of units means minutes waiting to rebuild. In this game every second counts, and a minute feels like an eternity. I never see my requisition-per-minute counter passing 350, and it usually sits at about 200. One squad of Tactical Space marines costs 500. Are you seeing the issue here? If your marines die, you’re probably going to have to wait two and a half minutes for the requisition to accumulate. It’s rare that you’ll have any left over or stockpiled, because really you should be spending it all on more units, upgrades, an enhancements.

That little math problem aside, all of the Space Marines units are just plain too expensive. I often find myself stuck with two scout marine squads wondering how on earth I’m going to afford any other units, let alone upgrade my base or buy higher tier units. All of the other races have much cheaper base units. Granted, they are weaker, but at least you can afford them. Basic infantry (ranged and melee) squads in the other races run at about 270 requisition

The Eldar even get a 4-man suppression turret for 270 requisition. Based on this, I hereby declare the Eldar over-powered. No infantry squad can afford to be suppressed, and if you can cover lots of angles with the suppression effects, the other team is pretty much screwed. Punching through a line of fire is nearly impossible. You’ll either have to jump over the suppressing squad, tunnel under them, flank them, or somehow just avoid the fire. It almost never works, and you’re pretty much dead.

Similar suppression effects for the space marines cost 340 requisition for a devestator squad that, in my opinion, isn’t even as good as the Eldar’s. Tyranids must pay 400 requisition for a warrior squad, and then upgrade them for another 50 or so to get suppression. Orcs can’t even buy a suppression squad until they hit the 2nd Tech Tier. The best they can do is buy a shoota-boyz squad, and upgrade them with bigga-gunz. In my opinion, this doesn’t count. It’s an ability with a cooldown, and often the suppression doesn’t work or wears off too quickly. The cost to get that would be about 270 requisition plus another 50 or so for bigga-gunz.

The game seems to have a few parallels to Blizzard’s Warcraft III, though they play them down so it doesn’t seem that way. First off, you select a “Commander” to lead your army. Each Commander sort of plays a different role. Offense, Defense, Support, Tunneler, Assassin, etc. The Commander (and all other squads) level up, and get stronger (yes, stronger) as they kill units. To me, this almost doesn’t make sense. If you are on the wrong end of the stick getting your ass handed to you, do you really want the other guy just gaining an even bigger upper hand? While he’s stockpiling requisition and you are getting little to none?

Also, a large part of Warcraft III was the “Upkeep”. What happened with upkeep was that when your army got large, you only got a portion of any resources you harvested. It isn’t ever mentioned in this game, but if you pay attention you will notice that you get a lot less requisition-per-minute when you have a standing army than when you have next to nothing. Compare the screenshot below with the screenshot above:

As a final thought, it also doesn’t seem to matter how hard you work to take requisition points. In the end it hardly even matters. I laid the smack down on the highest level computer player and took every point possible as quickly as I could. This actually HURT me, and I acquired less requisition than he did in the course of the game. Now how the hell did that happen?

This is warfare, not welfare!

It seems like the only strategy that matters is stealing people’s power. This keeps them from upgrading their headquarters, getting higher tier units, and getting upgrades.

Posted in PC Games | Tagged , , , , , , , , | 1 Comment

Spore DRM Causes Creature Backlash

The creators of Spore tangled with the internet and got more than they asked for. Users around the world, ticked off about Spore’s DRM have began creating anti-DRM creatures to voice their opinions.

Read more from the original article.

Posted in Bad DRM, Programming | Tagged , , , , | Leave a comment

Easy Text Area Character Counter with Javascript

Have you ever wanted to add a character counter to a box of text on a web form, but didn’t want to get your hands dirty with all of the Javascript and programming that’s necessary to make it work? If you said yes, then start getting excited right now.

Recently, I had the need to create a character counter for some text areas on a web form. As many people have come to realize, most browsers don’t enforce a maxlength on text areas. To help handle this, I wrote a little script that finds maxlength attributes on textarea elements. Once they are found it ties the element to a function that will count the characters, and force cut offs if you require it.

Remember, you should always double check your lengths on the server side before you send the values off to wherever they may be going. People can disable Javascript on their browsers to get around the limits you set.

Check out the demo below:

Demonstration Form

Using the code is very simple. All you have to do is include the script into your document’s source, and then attach attributes to your textarea elements like this:

Example Code

<textarea name="fixlength" maxlength="300" lengthcut="true">your text here...</textarea>

You’ll notice two new attributes not usually placed on textarea elements: maxlength and lengthcut. The maxlength attribute makes the code display the character counter. If you add lengthcut="true" the maxlength will be enforced and will not allow users to type past the limit. Check out the full code example below…

Example Code

<form method="post" action="YourScriptHere.php">
<textarea name="getlength" maxlength="300" rows="5" cols="45">Demo Text. This field has a maxlength</textarea>
<textarea name="fixlength" maxlength="300" lengthcut="true" rows="5" cols="45">Demo Text. This field has a maxlength, and the length is enforced.</textarea>
<label></label>
<textarea name="nolength" rows="5" cols="45">This field has no maxlength.</textarea>
<input type="submit" value="Submit" />
</form> <script type="text/javascript" language="javascript" src="/scripts/charcount.js"></script>

Adding extra elements with Javascript on the fly after the page loads? No problem! Simply call the parseCharCounts(); method after your new textarea has been appended to the document. The script to make find then new textarea elements and handle them accordingly.

Ready to use it on your own pages? Download or copy the source now for free!

  • Right click and select to save, or click the link to view or copy the source
  • DOWNLOAD NOW: charcount.js

Posted in Javascript, Web Programming | Tagged , , , , , , , , , , , , | 12 Comments