Categories
Game Development

Learning Kyra

Today was my first Monday without worrying about homework in a long time. Sunday will be the Chicago Indie Game Developer meeting, and I want to make sure I can say I’ve accomplished something.

One of my goals was to program 5 hours per week at the minimum. While I wasn’t able to do it consistently, I did program on my own projects much more often than I did last month. I even managed to fix up my Tic-Tac-Toe game so that it is a completed project under my belt. I’ve been learning, but now that school is no longer a worry I can accomplish much more in the coming month.

Another goal was to learn how to use Kyra. I haven’t touched it since I got the demo running on my machine. The demo was quite impressive and showed the power of the Sprite Engine. So I set to work, but I had some issues.

I created a directory in my Projects directory called KyraTest. I setup a Subversion repository and setup my documentation, source, and resource directories. Kyra comes with a tutorial, so I started there. The tutorial involves using a few images together. I wanted to start simply, so I cropped a photo of my head and shrunk it. I figured I could later add a cartoon body to it and have a bunch of characters running around on a screen. For the moment though, I just had this head.

I was able to create the .dat and .xml files from the sprite editory provided. I then copied one of the tutorial code files into my source directory and edited it to make the references to my own data. For some reason the file was written as if you wouldn’t have Kyra or SDL actually installed. It would have lines like:

#include "SDL.h"

All well and good, but why not use the system include instead of a local one? If you know, please let me know why the first way would be preferable.

Anyway, once I got that part squared away, and fixed the bugs I introduced when I edited the file, I got it to compile. Unfortunately it wouldn’t run because it couldn’t find libkyra.so.0. I found that it was installed on my Debian system, but there wasn’t a link created in the standard location for libraries. Once I created the link, it worked fine.

The end result: A black background with an image of my head in the middle. B-)

It was what I set out to do for today before going to bed, but it was kind of frustrating getting to that point. I sent an email to the author explaining the issues I had and how I fixed them, and I also asked for explanations on some of the code decisions.

My goal for this week: I want to make an application where a bunch of clones (with goatees, of course) are chasing after the real me (sans-goatee) before the meeting on Sunday.

And for the code collectors:
KyraTest.tar.gz
KyraTest.zip
Kyra Source in .tar.gz format
Kyra Source in .zip format

NOTE: You will need Kyra v2.0.7 to use this code. Also, the comments in the code weren’t all updated to reflect the fact that I’ve changed it. It is licensed under the GPL or LGPL as specified.

Categories
Game Development Games

Postmortem: GBTTT-CLI

Awhile back, I gave myself a goal of trying to create a simple Tic-Tac-Toe game within a week. I didn’t want to just copy the ubiquitous code out of a book, though. I wanted to take a project from intial design to implementation on my own. This project was not meant to be something commercial quality, nor is it meant for public consumption. It was just a way for me to test my rusty programming skills as well as practice using some of the tools I was experimenting with before, such as Subversion.

I did it. I called it GBTTT_CLI, which stands for GBGames Tic-Tac-Toe Command Line Interface. No graphics. No sounds. Just a simple Tic-Tac-Toe game. You decide who goes first, and each player will select one of the spots to place his/her piece, either an X or an O. At the end, the game will tell you who has won. Simple. B-)

What Went Right:

  1. It was not made with just one code file.

    Tic-Tac-Toe is a very simple game. It doesn’t need to be object-oriented, nor does it need much in the way of content. Still, I wanted to separate elements, such as Players and the Board. For the most part I succeeded. I could replace the Player with an AIPlayer at a later time easily. I could probably change the implementation of the TicTacToe game class so it can be done over a network without changing much of the other code, if any.

  2. Development went along fairly quickly.

    GBTTT_CLI was the first project I have worked on while using a safety net. Revision control tools are amazing and I wish I would have known about them years ago. I used Subversion, and while I rarely needed to backtrack, especially in a small project like this one, it was useful to go through my log to see what changes I made before. There was also a time when I made a LOT of changes only to get nowhere with them. It was easy to revert all the code back to the way it was before the changes were made. It saved a LOT of time for me when I could have otherwise just been trying to make changes to get back to a stable state. With a single command, I was there.

    Another thing that helped was the ease I had with actually coding. I underestimated my coding abilities because I thought I was starting from scratch with C++. The truth was, I could program, and I just needed to learn C++’s syntax correctly. There were a few things that I got tripped up on, such as NULL instead of null as in Java, but a quick look at my reference material showed me where I was going wrong.

  3. The game got completed.

    It was a project that I was able to finish. It may not be much, but it is more than what I had before, and I am proud of that fact. It’s also shows that I have the ability to work on my own designs.

What Went Wrong:

  1. It took me too long to get here.

    My goal was to get this program done in a week, and in total programming time, I did way better than that. Unfortunately if you count the days from when I first posed this goal to myself until I finished it, it was way longer. When I started coding, I got a lot done within a few hours. Then nothing for days until I tried to work with it again. Then I got some strange error. Nothing for weeks. Then finally I finished it. So I had a few hour spurts of productivity followed by long periods of nothing. To be fair, it was not like I was just avoiding the project. I had other responsibilities in my life, such as homework. But to be brutally honest, I wasn’t making the time for this project either.

  2. I overdesigned the classes.

    It is Tic-Tac-Toe. How do you overdesign it? I did. I thought that if I created the classes first, they would be useful as tools to build the actual game. I still think that it would be good to design the project this way, but my problem was in designing in specific features. The Player class has a Record member. The Record class holds the Win/Lose/Tie records of that Player. I wrote the classes in this way because I originally envisioned a single game session letting you play multiple rounds. In the end, I decided not to implement that since it did not need to be done to accomplish my goals. So now a Round is useless in the project. I didn’t spend too much time making it, but there are other elements that were made but not used. For instance, I also thought this would be a great way to learn network programming, so I tried to anticipate it by making Boards unique. I could have saved time and effort by deciding to add such things later or in a new project.

  3. The code is ugly.

    When I originally programmed in QBasic, I had no concept of code structure and variable naming. When I learned C++, I thought it made sense to follow what C++ did: variable and function names would look_like_this. Then I learned Java. Java programming practices are clean looking. A class name looks like: ClassName. A variable looks like: variableName. When I went back to C++, I got it in my head that I probably should keep it looking like C++, where standard library naming conventions have the underscores as mentioned above. That is when I started the project.

    Then I found a C++ coding convention guideline. Apparently Java-like style has its place in C++, too. Well, I did not want to go back and rename everything, so when I continued to work on the game, I kept using the same style rather than confuse everything, me included. The end result is commented, cleanly separated, but somewhat hard to read. A sample:

    // switch to next player
    game.next_player();
    // keep asking for input until value is legal
    int move = player_current->get_move(board);
    bool is_legal_move;
    is_legal_move = board.isLegal(move);

    Huh. Well as you can see, I did not succeed in keeping the style uniform. Board::isLegal() should be changed to Board::is_legal() to accomplish that. Still, it’s hard to read because of the style.

I know there is normally 5 of each in a postmortem, but come on, it’s Tic-Tac-Toe!

What I Learned

  1. Practicing programming is important. I should treat it as such and make the time for it rather than hoping I have an opening in my schedule. There won’t be one if I leave it up to everything else.
  2. Iterative programming is useful because I can avoid overdesigning something that won’t get used
  3. Programming is still fun, just like I remember it.

Even though I am disappointed in how some things turned out, I am satisfied. It’s a completed project! I was originally going to leave it in a state of incompleteness and start working on a more attractive project idea, but I decided to be “great” rather than “good enough”. If I keep that attitude with these smaller projects, it will be a good habit to have when I tackle larger ones.

I think I will post the code at a later time. I originally did not think it would be something I would publish, but I figure it has to help someone besides me. I’ll need to add a proper README and installation/compilation instructions first.

EDIT: Hey, I delivered. B-) And in two forms:
gbttt.tar.gz
gbttt.zip

Categories
General

Last Week of Class

Tomorrow is my second to last final of my graduate school career. Thursday is my last one. Then I am free.

Free to learn about the topics I want to learn about when I want to learn about them.
Free to learn at a faster or slower pace as I choose or need.
Free to use my time to make a difference in my own abilities for my own sake rather than for a higher GPA.

Some people want to go on for higher education, and that’s fine. Maybe in the future I might see a need for it myself. But not now.

Seth Godin wrote about some Harvard hopefuls who will not be able to attend because they found their admissions status early in Good News and Bad News:

The fact is, though, that unless you want to be a consultant or an i-banker (where a top MBA is nothing but a screen for admission) it’s hard for me to understand why this is a better use of time and money than actual experience combined with a dedicated reading of 30 or 40 books.

If this is an extension of a liberal arts education, with learning for learning’s sake, I’m all for it. If, on the other hand, it’s a cost-effective vocational program, I don’t get it.

So those rejected by Harvard (for a stupid reason, I might add) may in fact have been given a gift. Why spend years sitting still in school learning about the past, when you can blaze a trail onwards and read about the past at the same time?

It’s what I hope to do.

Categories
Game Development Games Geek / Technical

I’m Live not-at-the-GDC!!

The big news in game development these days has been surrounding the Game Developers Conference. A number of indie developers have covered the event, including David “RM” Michael, Saralah, Xemu, and Thomas Warfield. I’ve had to read about it and see pictures of people I’ve met in person or online, missing out on the fun.

I’ve read a few of the writeups that David Michael wrote for GameDev.net, and I intend to read the rest. I’ve also been reading Game Tunnel’s IGF coverage, including interviews and day-by-day news. It’s just like being there…only not.

Congratulations go out to those who made it to IGF finals! Some amazing games have been made by indie game developers, and they serve as an inspiration to the rest of us. This time next year, I hope to attend.

Categories
General

Comment/Trackback Spam

Ever since I started this blog, I’ve gotten comment spam and trackback spam. It used to just be someone using a handle that will link to some poker site, but now they are getting insulting. “It’s people like you are the problem with this country” was the latest one. Well screw you and your online poker website!

EDIT: And it seems that Seth Godin is also posting about blog spam, but this one is of a different nature.

Categories
Personal Development

My Last Class Assignment

I am coding my last assignment of the quarter. It’s the huge project for the class, and it is due on Thursday. I didn’t know that fact until last Thursday. The class forum shows that I wasn’t the only one, which makes me feel a bit better about “forgetting” something that wasn’t very clear to begin with.

Anyway, within a few short days my last assignment will be complete, and after finals the next week, school itself is over. No, I will not have a graduate degree, but I will have more time which can be utilized in more meaningful ways. I can work on my own projects. I can work on my own skills. I can reintroduce myself to people I haven’t seen in some time. It’s weird how this time last year I never valued my time and was always stressed just trying to get by! I guess it shows how much I’ve grown, but it also shows me that I have a lot to learn as well.

In the meantime, since my internship requires me to attend school, I’ll need to find another job soon.

Categories
General

Blogging is Advanced Netizenship

The concept of “citizen publishing” is one I heard originally from Ripples. It inspires images of any person being allowed to say what he wants to say without some corporation or government telling him he needs to conform to rules and regulations or satisfy some shareholders or appeal to some mass market. Naturally some people may not have much to say compared to others, but that just gives people the incentive to blog greatly. People read blog posts by Seth Godin because he is not only an authority in his area but also writes about important and compelling things. On the other hand, if someone blogs about inane things or makes stale arguments, it is less likely to be read. But the nature of blogs is that he’s still there, and if someone wants to listen to him, he/she can.

To paraphrase a line from The American President, blogging is advanced netizenship. You can post in an IRC channel, and within minutes your comments are gone, possibly remembered in some obscure log file. You can post in a web forum, among all the other posts there. Eventually it can drown out. But your blog is the online extension of yourself. Your commentary. Your views. Your growth experiences. People may have different opinions, but you have yours.

From Playing With Fire:

When we engage in blogging, we are playing with fire. We are harnessing the power of open communication in ways which will shape our future in ways we can’t even imagine.

To drive this point home, you should realize when we blog about something, we actually change our future in respect to that area on the fly. Now, if that isn’t that a sobering thought, what is?

Sobering indeed. Each blog post has the power to change viewpoints, politics, public opinion, and trust levels, and wielding such power should give people pause. One of the things analysts will tell you is that while blogging has had the power to topple major mainstream news figures and politicians, it is also something to be wary of. Someone may post something erroneous, and the nature of blogging is that it will spread like fire.

Of course, what this fails to take into account is how fast corrections can be spread as well. Print newspapers have to wait a day to post a correction, and the correction will usually be buried in some 12th page or something. Bloggers making corrections are front and center. Still, the concept of any one person being able to cause such a massive ripple through the World Wide Web, of any one person being able to publish his/her information to the world without placating some commercial publisher, of individuals all having so much more power than before is awesome. Nothing has probably had as much inspiring discussion about it as when the idea of “government of the people, by the people, for the people” was first introduced.

Categories
Game Development

Starting Small

I found this link today in my blog reading: Just Barely Enough Design. It goes through the idea of starting small instead of trying to undertake something huge.

To this day, I am sorely tempted to undertake the whole grand dramatic turn-the-world-upside-down vision…or nothing at all. The trouble is more often than not you end up with exactly…nothing at all.

This is one of the (recurring) lessons from the dotcom days I’ve beat into my head the hard way (yup, way over-planned, over-designed, over-architected and flopped – and that’s how I finally got to be a big devotee of agile software development).

It also quotes Linus Torvalds:

Nobody should start to undertake a large project. You start with a small trivial project, and you should never expect it to get large. If you do, you’ll just overdesign and generally think it is more important than it likely is at that stage. Or worse, you might be scared away by the sheer size of the work you envision. So start small, and think about the details. Don’t think about some big picture and fancy design. If it doesn’t solve some fairly immediate need, it’s almost certainly over-designed.

The idea of starting small is one of the reasons why Game in a Day is so attractive. I know I won’t be making anything huge or general so I can concentrate on just doing it.

Categories
General

Agile Development Seminar

My university is hosting a series of seminars for computer science alumni. I’ve never really gone to seminars or speaking engagements. I had the privilege of hearing Robert Spector speak at a company-wide seminar on customer service, so employees were pretty much supposed to be there.

Today was the first seminar in the series titled Agile Methods for Effective Software Delivery. I originally wasn’t going to sign up for it, but then I thought, “I don’t really have many opportunities to meet developers. Why miss out?”

I’m glad I did sign up for it. The actual presentation wasn’t terribly new and informative, but then I think it was geared towards an audience of alumni from the 80s and 90s, people who may have been out of the touch with the latest development methodologies. Now, I don’t have much practice with networking, but I also understand that it is usually the most valuable part of such events. So I introduced myself, made some conversation. People exchanged business cards, and I of course didn’t have one (next time, Gadget … next time). I got some advice from a few people regarding how to become more valuable in an employer’s eyes and focus on a set of skills. I heard some anecdotes about experiences in jobs and with customers and management. Definitely informative. And right before I left someone came up to me to talk about my job situation and experience, giving me some tips.

I’m definitely going to sign up for the seminar next month, Emerging Trends in Business Information Visualization. I don’t have a direct interest in the topic, but an emerging field is always good to learn about, especially if it means getting in on the ground floor. Other topics, including Open Source Software and Personal Knowledge Management, sound good and I’ll definitely attend those. And of course meeting with other alumni would be the best part, including new people and those that I met today. Now I only need to make some business cards…

Categories
Game Development

Programming Goals: 5 Hours/Week

At the Chicago Indie Game Developer meeting on Sunday, we had the biggest turnout since I started attending. Among the new faces were some developers of the MMO game Endless Ages (the website of which seems to be down). It was interesting listening to them talk about working in the mainstream game industry and being between jobs. It seems more than a few of us are talking about getting new jobs. B-)

Anyway, my goals for the past month were to learn about game APIs and setting aside time to practice programming. As I described before, I did look into Kyra a bit, but only enough to run the demo and go through the tutorial a little bit. So that goal is somewhat met. On the other hand, I didn’t do much in the way of programming. Currently I’ve been working on homework because I have to do so. I think to myself that I will work on my own projects when the homework is completed, but the problem I have is that the homework either never gets finished or I have to immediately start on the homework for the other class I am taking. The result is that a month went by without me dedicating much time if at all to programming.

This month, besides getting more intimate with Kyra, I picked what should be an achievable goal: 5 hours per week. Each week I will dedicate 5 hours to programming in C++. It will be my homework that will get pushed off this time. It should be fine since most of my productivity comes when I get in the zone about the homework anyway, and that won’t happen until I’ve read through and understood the Java code involved. I’ve found that my homework can get completed within hours that way.

Last month I failed to program partly because I never got around to picking a hard number of hours or lines of code or anything. It was just stated as, “Need to program more” which is too vague and doesn’t inspire me to do much. If I have to program for 5 hours a week, however, I can track it. Is it Friday? I’ve only worked for an hour all week? Well today and tomorrow have to make up the other four! Also, if I program for longer than 5 hours in a week, I am not counting it towards the next week. The goal is to get practice and learn while doing it.

Before the meeting broke up, I asked the programmers there for advice. I explained that I know that I need to practice more, but I also wanted to know if they had any other suggestions on what I should be doing. Everyone basically said that I should “just do it”. There. What could be simpler?