Category Archives: coding

coding and other computer-related thoughts

customer feedback and early access

Just before the holidays I completed my penultimate semester of college, in which one of my classes was on Software Business, in particular about starting one. One of the most important things we talked about in the class was customer validation before you begin making the product. Before you write the software you find out what it is that the customers wanted. In the course of the class we formed groups that acted as start-ups and we did surveys to find out if people would actually buy the software we were going to make. (Most of the groups were just in it for the grade, though a few were planning on taking their business ideas beyond the scope of the class, for which I applaud them. I was certainly not one of them.)

The point of the exercise was that before you put a lot of effort into making a piece of software you should figure out if people will buy it, and what they’ll be willing to buy it for. As Steve Blank said “No business plan survives first contact with the customer.” So, better to have that contact before you invest time and money into that business plan.

This also applies to the game industry. When you are making a game you want to make sure the game is fun to play, that the mechanics work and that your players understand your story. As you make the game, though, you get blinded by your own bias and you become unable to see the flaws, the things that might be unclear, or the things that might not be so fun. In order to make sure you have the best game possible you want to get outside input. Just like in the software industry many companies will do an alpha or a beta release.

In comes “early access”. In the past year we’ve seen more and more games starting to get released under the early access system, either on Steam or through their own sites. The idea behind these games being released in this way is that developers can get player feedback so that the game can be even better.

Cube World, being developed by Picroma, currently in alpha
Cube World, being developed by Picroma, currently in alpha

From the Steam website:

We like to think of games and game development as services that grow and evolve with the involvement of customers and the community. There have been a number of prominent titles that have embraced this model of development recently and found a lot of value in the process. We like to support and encourage developers who want to ship early, involve customers, and build lasting relationships that help everyone make better games.

This is the way games should be made.

There is merit to this, and there are success stories that show that early access to a game can help the game develop into something great. Minecraft, for example, exploded in popularity during it’s alpha and beta releases, giving the developer Mojang access to mountains of player feedback. It’s a game that continues to evolve even today, each new release adding more to the game.

Unlike a pre-purchase of the game you get access to it immediately, and from the get go you can play the game in it’s current form. However, both pre-purchase and early access come with one inherent problem:

You are buying a game that is not finished yet.

When you pre-purchase a game you are paying for something before it has come out. You have no idea, and no way of knowing, if it is any good. With early access you are paying for a game that is in progress, but you also have an opportunity to be a part of the game’s development, which is a unique opportunity. However, you have to keep in mind, the game isn’t done yet.

Hearthstone, Blizzard's digital CCG, currently in closed beta.
Hearthstone, Blizzard’s digital CCG, currently in closed beta.

There will be problems, there will be crashes, there will be changes, there will be bugs. As long as you understand the risks associated with purchasing an early access game then there isn’t a problem. Getting early access to a game is a great opportunity, however, early access in itself as a business model is doing damage to the gaming industry.

Not everyone understands that the game isn’t finished yet. When the game is released to the public in an unfinished state it effects the way that people view the game. When the crashes and the bugs happen those become what are focused on, and it does damage to the game and to it’s development cycle. People who were at first excited about the game coming out start to lose interest, and the game can die before it’s even finished.

If you want to be a part of the process, if you are interested in seeing the game in it’s early stages, if you are willing to put up with the problems and the crashes and the bugs than by all means, by that game in early access. I myself have played a number of these early access games. The important thing to keep in mind is this:

The game isn’t finished yet.

You can’t judge an alpha or beta game based on it’s current state. The game isn’t done yet, so don’t judge it based on what it is, but on what it can become.

a tale of bad user interface

I wouldn’t consider myself an expert on user interfaces, or UI’s as they are often called. However, I do use computers a lot, and I mean a lot, so I think I have a bit of experience to spot a bad UI when I see one.

I have an android phone, and since android is an open source software that is altered by the manufacturers to fit their particular needs I don’t know whether to blame Google or Pantech for this one, but either way, my phone has a particularly bad flaw in it’s UI.

There is not anything really secret or private on my phone, but I am still a security conscious individual, so I decided recently to try a pattern screen lock on my phone. At the bottom of the screen lock there is a small button that says “Emergency Call”. This has been the cause of my problems.

Two days in a row last week my phone called 911 while in my pocket. Now, if you’ve ever accidentally dialed 911 you know that if you don’t stay on the line they will call you back to make sure everything is ok, like they should, however, this meant that two days in a row I had to explain to the person on the other end that my phone dialed 911 on it’s own, while in my pocket. I got to sound like a complete idiot two days in a row.

I understand the reasoning behind the button. If you are locked out of your phone and in an emergency you need a way to make the call without the pattern, either because you are panicking or it’s not actually your phone. However, it’s placement on the main page makes it way to easy for something like what happened to me last week to happen.

So, needless to say, I won’t be using a screen lock anymore…

first impressions: PyGame

So, I’ve decided that every time I use a new language or framework for the first time, I will write a little first impressions post about it.

This spring term I am taking a computer graphics class, CS 455 at BYU for anyone interested. It has been a really interesting class, and the projects so far have been both fun and informative. The latest project we were assigned to do was an Inverse Kinematics solver. If you don’t know what Inverse Kinematics means and you want to, you can read about it on wikipedia, but that’s not the point of this post.

We were given a framework, basically a starting point, using XNA that we could use for the project. Well, I ran into a little hitch there when the CPU in my nice gaming machine died. My gaming computer was also my only windows machine (I run Fedora on my school laptop). So… now what?

I decided I would need to learn and use a different environment, language and library to do the assignment. Being a big fan of Python I decided to try out PyGame, a library designed to help make 2d games.

This is, of course, a first impression, I have only spent about 8 hours total working with the system, but here are some initial thoughts after completing my first project in PyGame. First, a screenshot:

Screenshot from 2013-05-23 00:27:06

Syntax

Well, considering that this is a library for Python the syntax is, well, Python. That is a huge plus. Even if you are not familiar with Python syntax it is pretty simple to learn (unless you are an experienced C-related language programmer, then the lack of brackets and semi-colons might drive you nuts). It is a library that is simple to use for both experienced an inexperienced programmers. The entirety of the IK solver took only 155 lines of code.

PyGame itself plugs into Python like any other module. It provides a bunch of classes, methods and constants that make interacting with the game window really simple. Here is my displayPlanks method, which is used to draw all of the planks that make up the arm.

Before calling this method we already know where each plank is located as well as how much to rotate the image of the plank. We also know the position of the end-effector (represented graphically as a baseball). This method simply takes the image of the plank, scales and rotates it for each segment, and then prints all the planks and the baseball to the screen. All of that happens quickly and without a lot of code.

Documentation

The PyGame module is pretty well documented, and everything I needed was pretty easy to find as well. However, I must say that the color scheme used for their online documentation is pretty hard on my eyes.

Additionally, I was able to find some examples of some of my problems easily enough on google. There is also this free online book that is a pretty good resource to learn how to use PyGame, I only read chapter 2 and half of chapter 3, but it is easy to understand and is a pretty good resource for anyone interested to learn PyGame.

Power and Capability

This was a simply project, and I haven’t done a lot of research on this subject yet, but as far as I’m aware, PyGame is not designed to be a heavy-duty game development environment, so I doubt we’ll be seeing any best seller’s coming from it, but it’s simplicity definitely makes it worthwhile and capable of being a good way to prototype and make smaller games.

Conclusion

Again, this is a first impression, so if I have preached false doctrine, I claim ignorance as my defense. That being said, though, I was impressed at how simple it was to learn and build something with PyGame, and I plan to use it in the future for personal projects.

Here is a demo of the IK solver in action:

You can check out the source code for my IK solver on github.

udk

I’ve been starting to work and learn with UDK with some friends and classmates of mine. We’ve spent the past few months working on the start of a third person action game. I took the following few pictures today, just wanted to show off the progress we’ve made so far.

UDK 2013-03-30 11-27-51-78

UDK 2013-03-30 11-28-06-71

UDK 2013-03-30 11-28-23-93

python, a closer look

A while back I posted a short post about Python, and simply stated that I liked it. Looking back it was a very fanboy-esque post, rather than a post that actually explored the reasons why I like the language. In this post I intend to explain my feelings a little more in depth. Also, I apologize, this is going to be a long post with lots of code.

Style

Python is built from the philosophy that code should be readable and re-usable. This philosophy is built right into the syntax of the language, some of which may be uncomfortable at first to programmers that are used to C-style syntax.

  1. Lack of curly braces and semi-colons
  2. White space matters

Here is some example code. This is a small function that I wrote for an algorithm challenge a few months back. This function takes in 2 integers, x and y, and returns x^y % 10, or in other words, if you raised x to the power of y, what would be the last digit.

It takes some getting used to, but once you realize that blocks of code are separated by how much they are tabbed, in other words, everything that is lined up is in that block, then you can look at the code and instantly tell what is in which block. But Ike, you might say, you can do that anyways in Java (or C or C++). Yes, you can, however, you can also not, and get away with it. In those languages, blocks are separated by curly braces ‘{‘ and ‘}’, and you can get away with having everything lined up on the left side. Python forces you to write readable code, also, everyone writes code that looks the same, so you don’t have to take the time to either adjust your mind or re-stylize their code before you can read it. (For example, where do you put the opening bracket? On the same line or the next line? If you do it differently than I do, it takes me a moment to understand your code.)

Strong Dynamic Typing

Python features strong dynamic typing, meaning that variables can be assigned and reassigned to any type, however, they cannot be implicitly coerced into another variable type. So, because it is dynamically typed the following is a legal, where you first declare a variable as an int, and then change it to a string later.

Now, this in and of itself is not useful, and to some may even seem like a bad feature. However, the following example is where this does become useful:

This allows us to convert it into an int without the need for another temporary variable. We can even parse the string first, pulling out only digits, and then converting them to an integer. This saves us the use of another variable, and we can give our one variable a good, meaningful name.

As for strong typing, this simply means we can’t do something like the following:

Because Python is strongly typed we can’t coerce y into a string ans then concatenate it to x, we would need to explicitly convert it to a string first, then concatenate (or convert x into an int and add them, if that is the intention.)

Tuples and Lists

This for me is one of the best features of Python, at least of the ones I’m going to cover in this post. Tuples and Lists are very similar, they are containers that contain items. The difference is that tuples are immutable, they cannot be altered after they are created, and lists are mutable, they can be altered. There are other powerful container types built into Python as well, but in this post I am only talking about these two.

Both lists and tuples can contain elements of non-matching types. So a list can contain a string, an int a double and an object of some kind, same with a tuple.

Unpacking variables from lists and tuples is an incredibly useful feature as well. You can assign multiple variables at once to receive the contents of the list or tuple, dumping them out in one go. Now, here is where it is the most useful: Returning multiple outputs from a function.

When I first learned Java, I was annoyed by the fact that I couldn’t return multiple things from a function, and there were times when I needed to. In order to do something to that effect I would need to make a special class just for holding those data pieces and then return an object. Now, in Python, we’re basically doing the same thing, except there is less overhead if we use a tuple, and we can automatically unpack it on the other end.

And finally for lists, one of my favorite features of lists is list comprehensions. The following code returns a list of all the squares between 1 and 100 (inclusive)

This is equivalent to:

Dictionaries

I lied. There is one other container that I will talk about. Dictionaries, (in Python they’re also called dicts). This one built in container pretty much nullifies all need for pure containment classes. You know the ones I’m talking about:

The little classes that are used for nothing more than pairing stuff together. In my opinion, unless you are defining specific methods to be done with that data, there should be no need for a class like this. With python there isn’t.

Now, if we want to access and change, say, the address number:

And there we have it. This is a pretty trivial example, as there are dictionaries that exist in other languages as well. However, because of the dynamic typing of Python, we aren’t restricted by types. We don’t have to have a dictionary that maps strings to strings, it can map anything to anything.

They are incredibly powerful containers built right into the language, allowing you to do so much. Python is still an object oriented language, and should you need to actually need to store methods with your data you can always make a class. However, with dictionaries, as I mentioned, you don’t need to create arbitrary classes that do nothing more than store data with getters and setters.

Conclusion

Python is awesome.

This is by no means a full, complete tour of the features of the language. Instead, it’s just a taste of a few of the features that I personally found to be helpful, useful, interesting and awesome about the language. If you are interested in learning more, the python documentation is a good place to start. (I personally use Python 2.7 still, and all my code examples are in 2.7 syntax.)

crayon

No, I’m not referring to the waxy things you used to color with in elementary school.

For anyone who uses wordpress for their blogging needs, like I do, I highly recommend taking a look at the plugin crayon. It is an amazing little plugin that makes inserting code into your posts very, very easy. First off, it allows you to include line numbers with your code.

Secondly, people can easily change they way they view the code, making it easy to copy code that you post as an example. Double clicking on a code snippet will convert it to plaintext, removing the style and line number. Give it a try:

Thirdly, the syntax highlighting. There are different themes available to allow you to customize the color and so forth, however, the syntax highlighting is really nifty, supporting many different languages:

Python:

Java:

C++:

Even HTML:

I so far have really liked crayon in what little I’ve used it with, and I highly recommend you take a look at it, especially if you ever are going to include code in your blog posts.

why is CSS so confusing?

A note: if you so desire, open up searchingtobe.com so you can follow along with my garble and logic.

Been playing around on the comic site as well as here on the rant, and I’m discovering how .css is somewhat confusing. Now, don’t get me wrong, I understand the benefits, and it does allow for more customizable, and admittedly, more beautiful web pages, but it is confusing none-the-less. Also, I recognize my complete lack of expertise here, which is something that perhaps I will gain someday. Let me back up:

The Reason

At work I am currently working on a web interface for an up-and-coming product. However, the product is so up-and-coming, we haven’t really even started yet. So, knowing that for the time being I’m not doing actual coding on the project itself, and also knowing that I will be eventually, this is a great opportunity to get familiar with the tools I will be needing to use eventually. Now, web design is a hobby of mine, but certainly not my specialty. Without the ease of WordPress and ComicPress I would have never been able to have started “searching to be”. Well, at the very least I would have been unable to post it in any format other than a blogspot site. (Yes, the first couple comics I made were posted to a blogspot site.)

So, I decided today to dive into .css and such. But first, I needed something to work with. Recently I added a twitter widget to both my blog and my comic. However, while on my blog it works great and looks great right out of the box, on searching to be’s website it looked pretty bad. the words were black, and I have a dark theme in the background, making the tweets themselves unreadable. Now, this isn’t that big of a deal, I never say anything overly important on twitter anyways. However, this bugged me, so today I started to dig into it.

The Quest

First I used chrome to inspect the element and determine what css rule was determining the color. I found the following rule:

Okay, I thought, now I just need to find where this rule is and add a color rule, right? Well, I searched the style sheets for the ComicPress theme and for GreyMatter (my main theme). No luck. Digging into the html that was output by my site I found that this particular style rule was written inline into the html. Great, I thought, now what?

Well, how about if I insert my own rule into the style.css for GreyMatter? Well, that might work. So I go into the style.css and insert my own rule:

Bingo! I save the style.css and then reload the site. Sure enough, the words are now yellow, and the links are white, and you can now read my tweets. Mission accomplished.

The ‘Whoops’ Moment

Now, hold on a second, since there is yellow on the one sidebar, why not the other one? Surely now that I am a master of the style sheet I can change that one. Back to inspecting elements. Governing the “Archives” section on the right side of the page I found the following rule:

Okay, so this tells me that they are all links, and in that particular area we are overwriting their color to white, as opposed to the normal link color. A little digging showed me that this rule is located in GreyMatter’s style.css. So, let’s change that to yellow.

And… suddenly on the left side, in the twitter bar, it’s all yellow. The links, the ‘3 days ago’, everything. Now, on this site, there is no difference between the links and the text of the twitter box, but it still looks good. That was a little too much yellow for my liking.

A few more minutes of digging and experimenting later, I decided it looked good the first time, so I ditched the yellow, and brought it back to white.

However, there are now some other things that I am annoyed with on the site for searching to be. I may eventually go about fixing them, but now I realize how interconnected the things are. I certainly learned a bit more about how styles sheets work, and I think that the site looks better now. I had a friend look at both sites (I did some .css magic here as well, but I won’t bore you with the details) and asked him how he thought it looked, style wise. “Looks good, except the rant needs a background picture.”

Sigh… I know….

Update:

Turns out I was wrong, the tag in the style sheet for GreyMatter didn’t get read in the end. So, some more digging and I think I have a different viable solution.

The change this time is added in the style.css for ComicPress itself:

Adding the color attribute there seems to have done the trick.

Python

I love python. No, I’m not referring to the deadly snake type, but the programming language. A few months ago I started to learn the language, both for school and for work, and I have absolutely become converted to it. The language itself is built on the philosophy that code should be a) readable and b) reusable. The code itself should tell you what it does, rather than the programmer writing a mess of comments that eventually serve to do nothing beyond confusing the reader.

Also, another reason why I love python:

The pure simplicity of the hello world problem is a testament to the simple elegance that the Python language has. Code is neat and organized, readable, and reusable.