How to Set up a Unity3D Master Server on Amazon EC2

Hi everyone!

I want to write a short guide on getting a Unity Master Server set up on Amazon Web Services (AWS) on an EC2 Micro Instance. Firstly, Amazon Web Services are free for the first year as long as you are using a one micro instance (5GB image). As long as you do not have unassigned Static IPs or multiple instances running, you should not incur any charges. To get more information on what defines the free-tier you can go here: Amazon AWS Free. Let’s get started!

  1. Create anĀ Amazon AWS Account
  2. Go to the EC2 Instances page by clicking “EC2” then when that loads, in the lefthand navigation going to instances.
  3. Click the blue “Launch Instance” button
  4. Create a new Redhat Enterprise Linux Instance under the free tier in the preconfigured AMI’s
    amazon_01
  5. After you select it, it should ask about what instance type you like. This is where you skip this step and click on step 5, “Tag Instance.” You will see that an entry already exists, Name. You can go ahead and set the value for that to Unity Master Server for your convenience.
    amazon_02
  6. Go ahead and click on step 6: “Configure Security Group”. We need to configure the instance so that we can access the URL. The easiest way to do this is to open the instance on all ports on TCP and UDP. You will see that the instance is open on port 22 for SSH access, now we need to click the Add Rule button and add access via ALL TCP to anywhere on the IP and same with UDP
    amazon_03
  7. You do not need to configure anymore options. You can click the blue Review and Launch button then once you’ve review the details, go ahead and launch the Instance.
  8. You should be prompted to create a security key pair or use an existing one. This is VERY important. Do not lose the file you download when/if you create a new key pair! It is imperative that you download this .pem file to a secure location. If you don’t have it, there is no way that you will be able to access your VM.
  9. Ensure that it’s running by checking it’s status in the Instances page. If the instance state is not running, you may select it, right click, and command it to start with “Start” in the “Actions” section
  10. Now that the instance is created, we need to give it a public IP Address. Go to Elastic IPs under Networking and Security in the lefthand panel and create a new elastic IP. After you create this IP is VERY IMPORTANT that it is assigned to a RUNNING EC2 Instance. If you create an Elastic IP that is unassigned you are billed $0.005 every hour until it’s assigned. To assign it, just select it, then right click and go to “Associate Address”
  11. OK. we have a public IP for our instance, and it should be running. Good. We need to set up a way to SSH into the VM and starting messing around with the files. The best thing to do is to download PuTTY and install it
  12. Open PuTTYGen and then open your download .pem file in it (by selecting *.* All Files in the load file dialog). You can then go ahead and hit generate to create a ppk for the key file. You can put a password on it if you like. Just remember this password for later you will need to enter that in the putty console when you connect.
    putty_01
  13. Once that is complete you may open PuTTY and get your public DNS and place that in the Hostname box on the Sessions dialog.
  14. Before attempting to connect we need to navigate to the Connection section on the left and add our ppk into an SSH authorization section as you can see below:
    putty_02
  15. Now go back to the sessions page and you can save this configuration by putting a name like “Master Server” in the box below the “Saved Sessions” text and then then hitting the Save button.
  16. You should be able to connect without a snag. You will be prompted with a user account to log in with. If you type “root” it will tell you the correct user for that vm which could be something like: ec2-user.
  17. Once you’ve logged in you can go ahead and download the Unity Master Server using wget:
    wget http://unity3d.com/files/master-server/MasterServer-2.0.1f1.zip
  18. You need to unzip the file.
  19. Then build it:
    make
  20. You can then run it:
    ./MasterServer
  21. Then you’re done!

 

I hope you learned something in this tutorial and if you have any problems, just comment and I’ll do my best to help you!

Tom

C++ Event System using Delegates

Recently I’ve been working on an Event System in C++. You might be reading that right now and wonder why that small sentence makes it sound like a true endeavor. Well, it was. As many of you may know I’m a student at Champlain College, and in one of my classes, each of the students are tasked to use an event system or a messaging system in their game. The teacher provided us with one, and it’s really great and all, but I couldn’t help but feeling restricted, especially after having used C# for so long where the code is so forgiving, and easy.

I did some research and it turns out that a lot of event systems in C++ are organized in such a way that when you want to do events you must:

  • Create an EventManager class (nothing wrong with this)
  • Create an EventListener class (for setting up events)
  • Create and Event base class
  • Be restricted to use only one function to handle your events
  • Create a huge enum holding a key for each of your events (Can hash it for speed)

I saw those and my heart dropped. I immediately thought that is way to restrictive, there must be an easier way to get events to work. And so the researching began.

Continue reading “C++ Event System using Delegates”

5 Ways to Improve Your Flash Game

You just made the best flash game ever, huh? Is that so? Before releasing your game into the wild, make sure you try some of the following:

Add a Highscore Table

Highscores are a great way to get people to play your game more, and enjoy it. A highscore table in this day and age is becoming more of a standard for flash games than ever before. The player practically lives to be ‘the best’, so why not help them the best by letting them show it.

Add Achievements

This practically goes hand in hand with having a highscore a table. Users lately have been expecting a rewards for actions they perform in games. Major consoles have them, and if they have them, there’s no doubt that Flash game players will be expecting them as well.

Have Good Audio

Some people totally skip this part. This is a vital part of creating a great game. Games that totally skimp out on taking the time to get audio that fits the game are only hurting themselves. I’m not saying throw a sound effect on every little thing in the game, I’m just saying don’t be too intrusive on how it’s played out. Menu’s should have their own music, different locations in the game should have different music. Every viral and popular game has great audio that adds to feeling of the game. Imagine you’re doing the final level of Halo to vivaldi, not very epic is it? Vivaldi would definetly ruin the mood.

Use less text!

One mistake that most developers make is that they use too much text. People going online looking to play some free flash games after a hard day aren’t looking to read, they want to relax and have some fun. So, try to avoid lengthy instruction screens. Players are looking for simple intuitive controls. If you absolutely need to have directions in the game, so be it. But, add a skip button so they don’t have to sit through it. Then, show a graphics, or something real quick to tell the controls. Just so they know.

Spend a day or two tweaking

You don’t know how many developers skip this step and are just so eager to get they’re game out there that they forget to bug check, and as a result lose fans. Let’s say a developer gave the boss on level 12 too much health, resulting in half the people playing getting frustrated. Five minutes of adjustment could have made the game that much more enjoyable. Other things could be added to keep the players hooked are save games, cutscenes, special effects, and etc.

Making a great viral flash game can be a daunting task, but I hope this guide/outline will help make that task a little easier.

Please, don’t hesitate to comment. Your opinions are always welcome.

-Tom

Flash Tutorial #2 – The Basics of Actionscript 3.0

Hey there. I just finished up another tutorial about the basics of Actionscript 3.0 (AS3). The video is about 36 minutes long and covers a wide range of topics, including: variables, conditionals, operators, functions, events, and other general basic ideas in Actionscript 3.0 (and many other languages). By the way, I talk about all those pretty much in that order, slipping in little bits of data about other things as I progress through the video.

I also finally got around to submitting SpaceFlyer online, so the project page is now updated with a playable link to the game, or you can click here. I’ll be straight about this game, it isn’t really pretty, and it doesn’t exactly have a great story line, BUT there are some sweet mechanics!

Hope you enjoy them both
-Tom