Dev-Jam @ Cipher Prime

I’m pumped for tonight’s “Dev Jam” at Cipher Prime. The theme is racing so I think I’m going to PoC an idea that’s been bugging me for a while.

What makes it a “Dev Jam” and not a “Game Jam”? A game jam is conceiving and making a game in a set period of time. For the Dev Jam we were told the theme a week in advance. A game jam is a competition to make a relatively complete game, albeit small and unpolished. A Dev-Jam is EVEN ROUGHER. Instead of 24 hours to make a game it’s 12 hours to make a proof of concept, something that isn’t really much more than a cool mechanic that you wanted to throw on the screen and check out. It’s also an excuse to drink and not play Starcraft II.

Tonight the PoC I’m hoping to pound out is a starfighter racing game with a small twist. Your fuel is limited, so I want to make players be careful with their thrusters, BUT using up fuel also reduces the mass of your ship making you faster and more maneuverable. IF I managed to get that done with some time to spare I’ll probably throw together some kind of ‘ghost’ to record your lap so you can race against your past selves. (There is no way I am working out an AI or multiplayer in one evening.)

Now I just hope I can focus in class instead of doodling racing ideas :/

Posted in Uncategorized | Leave a comment

POSTMORTEM(Ludum Dare 24 : Evolution)

One week later. (it’s actually a little later than that now, but it was when I started writing this.)

Procedural Terrain + Randomized Objects

Evolver – QuadraTron’s Ludum Dare 24 submission

Le Game

Last week we wrapped up our 72 hour jam project Evo Explorer (It says Evolver in the title screen since we never got the time to replace the temp art. Lesson to be learned there for jammers, be prepared for everything you do to suddenly be declared permanent.) The theme, suggested but never picked for many jams running, was “Evolution”.

After exploring the theme a little we settled on the idea of exploring a randomly generated world and needing to evolve your characters abilities (simple stuff like jumping higher and moving faster) in order to explore more. It still sounds a little ambitious (failure didn’t really bother us, we came wanting to learn and getting some kind of game cranked out, even if not exactly what we started out aiming for) and I’m fairly satisfied with what we got done.

What worked

Streaming ourselves while working. – It allowed us to jump back and forth quickly to see a problem someone else was having, and it added a little bit of pressure from people watching us to stay on target. (And even when we went off target, we could chill and watch what someone else was doing, staying involved while taking a break.)

Terrain Toolkit API – I had used Unity’s Terrain Toolkit in the editor before so I knew it was a powerful tool, but I hadn’t tried accessing it through code before. With the bulk of the terrain generation code taken care of for me (I had to debug their code a little) I was able to have basic world generation done by Saturday afternoon. It would have probably taken the whole weekend and looked a lot worse if I had had to come up with the based terrain generation code from scratch.

Randomized Object Placements – I still think we weren’t completely sold on the concept of  randomized levels until Rob accidentally created a freaky forest with tipped over trees. Honestly, once we had the levels randomly populating themselves development slowed to a crawl since we were spending more time exploring what kind of levels would be created than we were working on the game.

What didn’t work

Boring terrains – Despite getting the terrain generation working early on, it didn’t really grow/expand much. (This was partly our fault for a lack of content to differentiate the terrains, but it was also a limitation of keeping the world realistic and fair despite being “random”.)

Object overlap – This is a complicated subject in my opinion . Overlapping objects can create “new” objects that keep things interesting(that’s good), but they also can lead to boxed in players, unreachable areas, or areas meant to be difficult to reach being very easy to reach(that’s bad). I could think of any really quick to implement techniques to get around this so I just left it as is.

Trees & Details – Unity’s terrains have really good support for trees and details, so I’m really disappointed I couldn’t take advantage of it. The current “trees” in the game are completely static, not influenced by wind and the “health” of the terrain. (Same trees in the desert or the grasslands.) As it is the trees are pretty much evenly distributed across the level (which is really unrealistic to me).

In conclusion, we got a fair start to a game done in a weekend, and I learn a lot in particular about basic techniques for randomly populating worlds. It also left me with a lot of stuff I discovered I didn’t know. (I haven’t actually made my own noise maps before, so that’s up next!)

Posted in Booya, C#, Caffeine, Game Jams, Plugins/Packages, Programming, Programming Algorithms, Projects, QuadraTron, Unity 3d, Video Games | Leave a comment

Skype for Windows Phone

So I may or may not have mentioned that I managed to hook up QuadraTron with some Windows Phones back during the Global Game Jam.

Long story short on the Windows Phone: I like the OS, and straight out of the box it would beat an Android hands down… BUT the market place is pretty bad (Searching the name of an app, letter for letter, doesn’t guarantee you’ll find it and searching for a calculator turns up porn, so yeah.) and the system is locked up really tight which makes certain apps near impossible impliment. What is a modern smart phone without good apps? No really, I’m asking, cause I have no idea.

Luckily the Windows Phone does have a few good apps, the ones that come with the phone, and a few that Microsoft made to fill in the gaps. And one of those gaps up until now has been Skype. (Finally got to it in the third paragraph, hey I’m getting better at this…)

Microsoft bought Skype a while back which was met with mixed excitement and trepidation. So far Microsoft seems to have done well by Skype, although it took them what felt like forever (something like a year and a half… so about 6.8 forevers to be precise) they have released a very nice looking Skype app.

I really like the interface. No, I REALLY like the interface. It’s spartan, with just the essentials, exactly what you want on a phone. I could go for a few more options under settings but Microsoft has this thing right now of “Let’s develop for monkeys that don’t know wifi from bluetooth” so that ain’t gonna happen. My mom doesn’t know wifi from bluetooth (I’m still trying to teach her that Google is a webpage and Chrome is a browser.) so maybe that’s a good strategy. Time will tell for sure.

The bad/ugly etc: It really heats up my phone running the video (oh did I mention it has video? Yeah, suck it Android.)  Also, the Windows Phone completely lacks multi-tasking(freezing apps in memory(technically it’s a call from the environment that gives the app a chance to save where it was(nested parenthesis FTW)) and resuming them IS NOT multi-tasking) so accidentally hitting your Bing-button = disconnected conversation. It doesn’t even run a background process like the email app that alerts you to chats/voips, you have to start the app every time you want to check on your IMs.

So basically the app itself is functional, the interface is nice, but it’s not quite polished yet.

Final Score 3/5

Posted in Uncategorized | Leave a comment

Killing Time with Game Design

I’d like to start with a giant disclaimer, I only said “Game Design” because it rhymes. What I’ve really been doing is playing with the 2d Orthello Framework and Texture Packer, both of which have free and pro versions.

So the first thing I wanted to see was how Texture Packer works, I’ve heard a bunch of game making cohorts say it’s really great. So far I’m seeing what they mean, though I personally feel like it adds a little bit of time to the workflow, but I’m not an artist so I guess I can’t really speak on the front.

The cool thing about texture packer is that it lets you take a whole bunch of sprites in folders and it will recursively add them and turn them into one texture atlas. If I need to tell you how awesome that is that you probably don’t know a lot about real-time computer graphics. IT’S A REALLY VERY POSITIVELY CHUCK NORRIS RAINBOWS AND FREE PARKING GOOD THING.

Even cooler, Orthello happens to read one of the data outputs (part of the secret behind Texture Packer is that it creates a xml-like manifest of the images, their sizes/positions/etc) that Texture Packer exports too (I decided to use OGRE, but they both also supports Cocos(iCrap) format.

That’s not to say I just waved my hand over the computer and a fully animated Samus (if you’re gonna steal a sprite sheet, steal one that’s really cool) appeared… although now that I know how to work it it’s pretty darn close.

First you set up a master OT object (just drop the prefab in) and then you start setting up the atlas/sheets you’ll need. Since I’m using texture packer, all I had to do was drag over the atlas and data files and it filled in the rest (Yeah, why don’t you just make the whole game for me too… IT’s TOO EASY DAMNIT!). Now you can set up animations. The way the Orthello people say it, it sounds like you could create multiple animations and switch between them but I ended up going with one animation that has a bunch of framesets. The downside of this method is that when the atlas gains or loses sprites I need to re-make all the framesets by hand. Maybe I’m doing it wrong, but I’d much rather set up the framesets by string since we’ve already got a nicely laid out data file.

Next up was dragging in a sprite, this part gave me a little bit of trouble because I had some settings wrong the first time around, but after some tweaking I got a sprite going. One possibly annoying thing that happened was Orthello decided to change my Main Camera all on it’s own. In this case that was totally cool, but in other cases that could spell disaster. Hopefully it only does that to the main camera, and only once at that…

Lastly was some code to fake platforming movement (pretend to run, jump). That part was SO FREAKING EASY. Seriously, with all the framesets adjusted all I had to enter (other than some control logic obviously) was:


Mind blown. Thanks Orthello and Texture Packer people.


Here’s a video of me playing around with Texture Packer and Orthello (and Unity 3d).

Since a picture is worth a thousand words, and at 24 fps this video is roughly 24 * ((24 * 60) + 11) pictures, that makes for roughly 32.8 million words plus the words I speak in the video. You’re very welcome.

Posted in Plugins/Packages, Stuff You Never Knew You Needed, Unity 3d | Leave a comment

Coding in your browser

The semester is almost over and I’m playing with some Python in my spare time (In addition to Unity (XNA is on the back shelf, it looks lonely back there…)) in an online course at Udacity. More on that later in the month.

I just stopped in to talk about how you can play around with and test code for several interpreted languages in your browser. Sure, we’re all got assemblers, interpreters, and notepad lying around… there’s something fun about typing up some quick bullshit code in your browser. You know, like when you had time to write programs that come up with stripper names.

Some Python Code:

def getData(person):
#Assume we looked up person’s name, age, and idNum
name = “Christian”
age = 24
idNum = 987239874928374

#Python ‘packs’ the different values
return name, age, idNum

#And ‘unpacks’ them, gotta catch ’em all
a, b, c = getData(‘Person key value’)

#Notice Python will add two spaces where we used the commas
#to seperate the int parameter
print a + ” is”, b, “years old.”

Place to make code do something: (Does a bunch of other languages too)

Notice the multiple returns? That’s freaking awesome.
Notice the lack of semi-colons and smexy squiggly brackets? That’s freaking lame. Also typing “or” instead of || (Though you can use the bitwise | if you absolutely must use the pipe.)

Another useful website to mention when speaking of coding in your browser is Pastebin. You paste code into your browser, give people the link to it (or embed it) and they get to see nicely formatted code (you can also change the code and repaste it).

I felt like tacking this on here instead of making a new post. These are cool places where you can see your code come alive (with shmancy graphics) in your browser (Cool functions of time every programmer should know)

Aside | Posted on by | Leave a comment

A quick and simple example(high score board)

The topic came up in Skype today, and I didn’t really finish the high scoreboard in a game I was working on recently, so I’ve finnished up and pulled together a few little code segments into a fairly vanilla script for Unity.

So first off, if you didn’t know already, Unity lets you store and access ints, floats, and strings on the hard drive using PlayerPrefs. More than enough for a quick highscoreboard. Better yet, since the PlayerPref keys are different for each game you can keep the hard coded names when you reuse the script. (It also means you can’t access those PlayerPrefs anymore if you change the name of your game.)

string[] scoreData;
void Start () {
 //Get old scores from PlayerPrefs
 //We'll assume it's a top-5 board for this example
 scoreData = new string[5];
 for(int i = scoreData.Length; i > 0; --i)
 //ie get string named "Highscore5", if blank set to/return "500,WUP"
 scoreData[i-1] = PlayerPrefs.GetString("Highscore"+i, (i*100).ToString() + ',' + "WUP");

So now we should have a bunch of strings that should at least have a useable default value if not actual highscore data. Most importantly we’ve just defined the scores need to be stored; number first, followed by the name and separated by the Record Separator character.

Let’s assume the highscore table is all jumbled up (damn gremlins!) and we want to sort the scores so that the names/names are in correct order. It’s a short list so we’ll use bubble sort. Here’s a serious explanation and a cool video.

In order to sort the scores we need their values, it’s as simple as splitting the string and parsing the integer. I’ve thrown it into a static method below.

public static int ParseScore(string str) {
 //return int parsed out of string index 0 returned by splitting the string at commas
 return int.Parse(str.Split(new char[]{','})[0]);

Now we can dance the bubble sort dance:

//Sort this array, simple bubble sort with premature exit
void SortScores() {
 bool swapped;
 for(int i = scoreData.Length - 1; i > 0; --i)
 swapped = false;
 for(int j = 0; j < i; ++j)
 if(ParseScore(scoreData[j]) > ParseScore(scoreData[j+1]))
 Swap<string>(ref scoreData[j], ref scoreData[j+1]);
 swapped = true;

This sorts out the scores into ascending order (lows-left). So we have some scores being read and sorted. This example took a little longer than I expected (doesn’t everything?) so I’ll wrap up with the GUI code and the Add-Score code later.

Posted in C#, Programming, Programming Algorithms, Unity 3d | Leave a comment

Semester Over (in practicality)… Back to Fun Stuff!

All my work for school is handed in, now I just have to make a few requisite appearances for a reading or two and a screening. Ooh yeah!

The Holiday Season! Christmas time is surely the best time of the year to sit at home and program! Wait… why is there a glowing tree in my– Why am I wearing a sweat– Who put eggnog in– AAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHH!

Long story short, mid-way through setting up Visual C# Express(Pro around here somewhere…) for use with XNA I decided to make a simple WindowForms App(ooh, shiny!). I’ve used Netbeans before, so I stumbled through it with grace and had a few little duh-moments with Visual Studio adding the code (machines… programming machines… scary shit man.) for me and all that Let’s-Help-Christian do it our way.

A simple enough program; get some text from the top, the users clicks a button and gets it all garbled up below. Then it sort of occurred to me: “Hey! I’ve never written my own shuffle algorithm, what’s the best way to do this?” …and they all went skipping down the yellow brick road to Google.

So after looking at a few threads here and there about shuffling I came to this blog post about naive shuffling algorithms. (It’s pretty good, read it.)

Jeff Atwood goes on to explain how a simple shuffling algorithm, which was strikingly similar to what I was thinking of using, becomes extremely biased when taken to the extreme. This isn’t just because random numbers aren’t random, it’s because simply iterating through an array and swapping it with another random index, for each item in the array creates more random possibilities than naturally exist.

Jeff uses an example of 3 playing cards. 3 playing cards have

3 + 2 + 1 = 6

possibilities. However swapping each position with potentially every other position creates

3 + 3 + 3 = 9

possibilities. 6 does not divide into 9 evenly, so there will always be a few possibilities that weigh higher than the others.

For the solution he points us to the Knuth Shuffle (which brought back a long forgotten memory of this being brought up in a class at some point as the Fisher-Yates algorithm) which states(borrowed(I’ll give it back(maybe)) from the Wikipedia page):

To shuffle an array a of n elements (indices 0..n-1):
  for i from n − 1 downto 1 do
       j ← random integer with 0 ≤ ji
       exchange a[j] and a[i]

Jeff provides an example on his page which I’ve adapted for my strings:

public static void Shuffle(ref char[] letters)
   //Get a random number from the future!
   Random rand = new Random(System.DateTime.Now.Millisecond + 3);
   for (int i = letters.Length - 1; i > 0; --i)
      //Get a random number that can include i
      int n = rand.Next(i + 1);
      //Trading places
      char swap = letters[i];
      letters[i] = letters[n];
      letters[n] = swap;

Check it out! ShuffleText(exe, needs .NET4)

This weekend, I’m going to try to get a simple game going in XNA. If I can find it I might remake my Shwack-A-Mole game.

Posted in Booya, C#, Programming, Programming Algorithms, Projects, School | Leave a comment