Tuesday, July 31, 2007

Making One of those Weeks episode 15, part 3

Once of the first things programmers should learn about computers is that they are very advanced state machines. A state machine is simply a machine that performs a series of actions, but the actions can vary based on the state of the machine. In the case of the computer, the actions are determined by the operation code contained at the current memory address that the program counter is pointed to. The states are the flags within the processor which are set and cleared based on the actions that the machine performs.

Puzzles within games can also be thought of as state machines. Or, if you find it easier to comprehend, a series of state machines, with some of the machines depending on the state of other machines. Instead of flags and registers, you have objects and actions. In an adventure game, the and in the case of episode 15, obtaining the nut is the state you want to put the machine into. To do this you need to have the nut. This is where having a mini-state machine within the game comes in handy. What is really interesting is that the state of the nut within the game actually helps determine the state of the rock within the game. Likewise, the nut state is dependent in part on the rock state.

The rock has four distinct states. It can be your basic rock, your rock with a husked walnut on it, your rock with a husked walnut on it, or your basic rock that has husk remains around it. The second state depends on the player having the husked walnut. The third state depends on the player having the rock. The fourth state is when the player picks the walnut off the rock.

The nut has three visible states, but internally has five states, one of which is shared with the rock. You have the in tree state, the husk state, the husk on rock state, the walnut state (which could arguably be broken into on rock and in inventory states), and the given to squirrel state.

Monday, July 30, 2007

Making One of those Weeks episode 15, part 2

If you have not solved the episode, the solution is fairly simple. First you pick up the rock that is in the room that you start in. Then you head west (left) and pick up the stick. Next you head to the far eastern room (right twice) where you can use the stick on the tree in order to get a walnut. The nut still has it's husk on it. You can try giving the husked nut to the squirrel, but it won't accept it and you will lose points doing so. Instead head back to the room with the big rock in it. Put the husked nut on the rock. Use the rock on the husked nut. Pick up the walnut and then give the walnut to the squirrel.

Once the ending sequence is shown, you are taken to the scoring screen. Scoring is done as follows:

  • 5 points for getting the walnut out of the tree
  • 5 points for putting the walnut on the rock
  • 5 points for using the rock on the walnut to remove the husk
  • 5 points for giving the walnut to the squirrel
  • -5 points if tried to give husked walnut to squirrel
  • -20 points if squirrel forced to kill you (yes this can happen)
  • -5 points if squirrel was forced to give you more than one warning to keep away from oranges

The lowest possible score that can be achieved is -25. There are two ways of dying in the episode. The easiest way is to simply throw a rock at the squirrel. While I do not track this action (way too much work would be required as I would have to have the game make a call to a server side page that counts the number of hits it gets) I suspect that a large percentage of the people who have played the episode tried doing this if only to see what happens. That is one of the nice things about games is that the consequences for your actions can be erased by simply re-starting the game. Sometimes I wish that the real world had a restart button. Anybody lucky enough to be born into a wealthy family already knows, it already has cheat codes.

The other way of dying is simply by pissing off the squirrel by not heeding it's warning. If you try to grab an orange three times, the third time the squirrel will make a lethal throw. Picky people might notice that it throws a rock for this and may point out that it has no way of getting your rock. My answer to this is to point out the obvious fact that there is more than one rock in the universe and that the squirrel obviously is smart so has a rock with it just in case Colbert (you will have the opportunity to meet Colbert in a future episode) pesters him.

Friday, July 27, 2007

Making One of those Weeks episode 15, part 1

After exploring the forest, you crossed the river and are close to an orchard that contains the hermit's Sun Fruit. For those of you who have not figured out this episode on your own, the solution is presented in the next section though as always I do urge you to try and figure out the solution yourself. In this section we will take a look at our surroundings.

As you can see from the map, the episode is broken into four separate areas which in adventure game tradition we will refer to as rooms. The start room leads to the other three rooms. On the ground in this starting room is a rock. Obviously, you can pick up the rock.

West of the starting room is a room with a big rock in it. This rock is obviously way too big to pick up. On the ground in this room is a stick that can be picked up. It is possible to interact with the big rock. You can try using the stick or the rock on the big rock if you wish. As is often the case in adventure games, when you can interact with an object in the game then that object serves some purpose. Sometimes the object is a red herring (something put into a game just to confuse the player). Other times it is part of an easter egg or inside joke. Most often it is part of the solution to a puzzle in the game.

East of the starting room is a funny looking walnut tree. You can tell that it is a walnut tree by the cluster of walnuts hanging from the topmost branches of the tree. Why would there be so few walnuts on the tree? One would have to assume that someone or something on the island likes walnuts even though they are such a pain to deal with. Could this be the sun fruit that the hermit was talking about? No, as nuts and fruits are different things.

North of the starting location is an orchard of oranges. It appears that this quest will be easier than you thought. Or not! That squirrel must be the beast that the hermit was talking about. It certainly does not like your presence in the orchard.

Thursday, July 26, 2007

Paper Coffee Quest

Just a quick post today. The vote about taking part of the Coffee Quest Revenge time to learn PaperVision 3D resulted in 92% of the vote for taking the time. I can only assume that people want the game in 3D as soon as possible. I am hoping that the game will be at least half as good as the game in my mind is, though development is taking a lot longer than I thought. Granted, a vast amount of the time is spent creating general purpose code that will hopefully be used by many future projects.

Wednesday, July 25, 2007

FLOSS - The Public Domain

To understand what the public domain is, you first need to know a little bit about copyrights. The copyright system has changed quite a bit over the years, and seems to be more focused on corporate interests than on public interests. Basically, when you create something you automatically gain copyrights on the item that you created. You can not copyright ideas, just the particular implementation of an idea. Copyrights last a set period of time. The particular amount of time varies by country, with the US being the life of the creator plus 70 years but corporation owned copyrights last only 95 years from publication or 120 years from creation (whichever is shorter) due to the fact that corporations are legal entities that can theoretically live forever. For the duration of the copyright, the owner controls what can be done with the work, though there are some exceptions for educational use.

When the copyright term expires, the material enters something that is known as the Public Domain. This simply means that anyone who wants to can take the public domain material and do whatever they want with it. To be perfectly blunt, the vast majority of material that has reached public domain status is too old to be of any real use. this is one reason a lot of people want shorter copyright terms. I personally would like to see 10 year copyrights that can be perpetually renewed for another 10 years for a small fee and the renewal information would be publicly accessible so it would be easy to see if something was still under copyright. The advantage of such a system is that anybody would be able to keep their copyrights forever if they desired, but less valuable material would fall into the public domain sooner so that there would be a much greater chance that it would be useful to society.

While the vast majority of the public domain is so old that it is not relevant to modern society, there is still a lot of material that can be used. For instance, Shakespeare has stood up to the test of time quite well. While you can still pay for a printed copy of a Shakespeare play, many archive sites have free copies of the plays that you can download. If you want to put on a play, you don't have to pay any type of public performance fee for using the material. In fact, you can even modify the play however you like. And that is where the problem is.

Tuesday, July 24, 2007

Save Points

I was going to past my second FLOSS entry today but yesterday Sega actually released a RPG on the Wii virtual console. Shining Force is the second game in the shining series of games, though I have never played any games in the series. I am probably going to be playing this entry as soon as I finish Paper Mario.

Since I am talking about consoles anyway, I might as well talk about save points. A lot of players don't like them, but from a development standpoint they are a rather nice way of dealing with the problems of saving a game. Saving a game, while sounding like an easy thing to do, can be a challenge. When you have memory restrictions on how much information can be in the save file, as you do when you are creating a console game, this becomes a major factor. This is why a lot of games reset rooms once you have left the area. By not having to track the state of the monsters in the room you can then eliminate having to save that information. This means that when you are saving the game all you need to save is the player's location, the player stats, and the key game flags.

Key game flags are bits of information that reflect what the player has done in the game. For instance, if you have a treasure chest, you don't want that chest to be magically re-filled every time the player exits then re-enters an area. To solve this problem you just assign a game flag to hold the chest state. If the chest has been opened, then the flag gets set and the next time you enter that area, the chest will already be opened. Of course, this also applies to switches, traps, bosses and any other game state information.

The thing is, if you are going to have the ability to save the game, why require it be done only from key points in the game? Could you not simply use the same flags and stat storage with a slightly larger field for allowing any game location to be the location? If so (and as a programmer I know it IS so) then you could very easily allow the player to save anywhere. All that would have to be done is saving a slight bit more information that contains the monsters in the particular room that the player is in. Even though the number of monsters in a room could vary, you just need to reserve enough memory to hold the maximum number of monsters that appear in a room. There are other reasons why this might not be done which I will discuss in a future post.

Monday, July 23, 2007

Level Limits

Sorry for not posting this earlier (I forgot) but the poll results for last week's Blazing Games poll were 100% for working on Coffee Quest Revenge until the 1.0 version is ready. As the few readers of this Blog already know, I am playing Paper Mario. Now that I am back to work, I will be limiting the amount of time I play to roughly an hour a day, so it will be a while before I finish the game. That being said I did run into one element of the game that I absolutely hate and in the future will ensuring that my own games will not have this major flaw.

The game started off fairly easily so I was just following the plot not building up my character other than through normal solving of the game. Then I hit the Dry Dry Desert, where I found the game a bit too challenging for my liking. For that reason, I decided it was time to build up my character. While I explored the desert, I was fighting all the monsters in an attempt to build up my character. This worked real well and I got to the point where the monsters were no longer a burden but I wanted to build up my character a couple more levels anyway to make the future areas a bit easier. After gaining a level, then went into combat and noticed that I never got experience. There are level limits in the game! Once you have reached a certain level, you no longer gain experience (star coins) from defeating a monster. This means that unless you need money, the fighting of low-level monsters is pointless. I should point out at this time that the money is capped at 999 coins, so once you reach that, picking up extra coins does nothing!

While I have no problem with games that reduce the amount of experience from defeating easier monsters, eliminating it is just wrong. None of my RPGs do this so I am not being a hypocrite on this subject. I must admit, however, as a lot of my RPGs do not have re-spawning monsters (something that most of my future RPGs will have) the lack of new monsters acts as a way of limiting how much a character can be built up. This is a bit different as you at least will always gain experience when you defeat a monster, so none of the fighting in my games is pointless.

Saturday, July 21, 2007

FLOSS - An Altruistic Movement

Most people have solutions to some of the world's problems. These solutions tend to be simple, and in an ideal world would work great. The problem is that these solutions don't take the world's greatest evil into account. This evil, which is inherent in human nature as it is also one of our most powerful survival traits, is greed. Greed can be seen every time an executive takes a million dollar bonus instead of giving a small wage increase to the workers who actually make the products. The end result of greed is destruction. Greed is counter-balanced by altruism. True altruism is rare today, as there is usually another motive for the apparent altruistic act. One of the most prevalent forms of altruism today is the Open Source movement.

The idea behind open source is quite simple. Instead of keeping the source code (the magic ingredient that makes software) a closely guarded secret, the source code is given away. The instant greed response is, “but then how do you make money.” Most open source companies, and there are many that have thrived, make their money from different means. Many open source companies give their software away and make money by selling support contracts. Others survive by sponsorship (such as advertising, which is why ad blocking software is inherently evil). Some survive by donations by the community of people who use the software. Yet others survive by having closed source packages that complement their open source offerings. I am sure there are other business models that I am missing, but the point is that there are ways of making money while still being somewhat altruistic.

Open source is different from public domain material as it is still copyrighted material. The permission to distribute the source code is part of the license agreement that comes with the source code. “But I never agreed to any license,” the greedy voice says. You don't have to in order to use the software. If you are planning on giving away, modifying, or selling the software then you have a problem, as copyrights forbid you from doing any of those things. The only thing that is allowing you to do any of the above things (and a bunch of other things that I won't get into here) is the license. If you don't want to agree to the license, you can't modify or distribute the software as that would be breaking the law! There, unfortunately, are a huge number of licenses out there, but the most prevalent one is the GPL or General Public License.

We will take a look at the different licenses later, but first let us explain why Open Source is even needed. Greed, of course, has a lot to do with this, as you will see in the next section.

Wednesday, July 18, 2007

Paper Mario

I was going to start my series of rants - I mean posts - on Open Source software today, but last night I took a look at the Wii online store and discovered that on Monday Nintendo finally released a decent role-playing game. For only 1000 points ($10) I got myself a copy of Paper Mario. It is about bloody time that a good RPG was released on the virtual store. Lets just hope that this is the start of a trend and many more good RPGs will be released for the virtual console.

Some people may not be familiar with the Paper Mario series. It is the follow-up series of games for a game known as Mario RPG. The Mario RPG was a game that took the Mario Brothers universe into the realm of Role-playing games. Of course, the Mario universe has been expanded into a wide variety of other genre of games.

The first impression of the game is pretty good. The RPG elements consist of Hearts (HP), Flower Power (Mana), and Badge Points. Badges represent your special abilities, which you not only get to choose, but can change at anytime. When you gain enough experience to gain a level you choose which of the three things you wish to improve. Combat is menu driven, though have an arcade timing test that gives you extra damage or reduces your damage. I will try to have a full review later.

Tuesday, July 17, 2007

Lunch time ramblings

There is no such thing as a free lunch. If you are not paying for it, somebody else is. This is true for the internet as well. The games on Blazing Games are free for the visitor, but the costs of running the site (hosting and bandwidth) still has to be paid for. In the case of BlazingGames.com, it is advertisers who pay for the bandwidth and me who pays for the game development as the time spent creating the games could have been used for a number of other things. I enjoy making games so don't mind donating my time, but wish I could find a way of being paid for my time.

As for the advertising, I really don't like the fact that the ad rates fluctuate so wildly. Sadly, that is the way the free market works so as more sites start adding more advertising, the rate for ads goes down. This is why I am going to try and supplement Blazing Games advertising revenue in a number of ways. The first thing that I am going to do is start offering sponsorship of episodes. I am thinking of offering both business and personal sponsorship of episodes. Personal sponsorship would allow someone to dedicate an episode to someone while business sponsorship would allow a company to have a link to their site. The sponsor would get a copy of the episode with permission to post the game on their site. I don't know if there will be any interest in this, but it can't hurt. If you or your company is interested contact me (webmaster) at BlazingGames.com.

Also, expect to see a series of posts on the subject of open source. These posts will be segments of a larger article on open source that I am creating for eventual posting on the Blazing Games website. After all, getting two birds with one stone is a great way of having a good lunch for half the price.

Thursday, July 12, 2007

GPL 2 for now

Last week I had a poll on Blazing Games about switching from GPL 2+ to GPL 3+ for licensing my Open Source releases. The voting breakdown was 57% for sticking with GPL version 2, 29% for going with version 3, 14% not sure about what this GPL thing I keep talking about is, and the remainder saying I should switch to a GPL 2 only license. I am thinking about posting a series of entries about my thoughts on the open source movement. I will make up my mind over the weekend, so don't be surprised if next week I start a series of rants about open source.

Friday, July 6, 2007


I started writing this blog last night while I was in bed. I never finished because when I rested my eyes just for a moment, I opened them many hours later. For those of you who were wondering, my laptop is on a fold-up table beside the bed. It's now my lunch break so I figured I would finish writing what was supposed to be yesterday's entry.

The results of the Blazing Games weekly vote are in. Considering the number of votes I got, you could consider the results to be unlucky. 77% of the voters said I could take my vacation immediately. 15% said that I should finish Coffee Quest Revenge 0.1 before taking my break. 8% said I shouldn't take a break and 0% said I should wait until after summer. This means that I will be spending the next couple of weeks getting caught up with everything with the only Blazing Games related activity being posting the site on thursday evening and an occasional blog post.

Last post I mentioned that there was an important omission on my description of tiles. The number used to represent the tile holds a number indicating which tile image to use. This means that each tile needs to have an 8x8 image attached to it. That means that the tiled image still needs to contain image information. If all 1024 tiles were unique, you will not have saved any memory at all. Thankfully, most games repeat the same chunks of graphics many times so you can save quite a bit of memory.

There is a lot more you can do with tiles other than saving memory on graphics. We will be looking at these advantages in future posts.

Wednesday, July 4, 2007

Tiles in games

For a while I have been trying to figure out the best way of covering this topic, which is fairly important to the understanding of how Coffee Quest Revenge in particular and tilemaps in the CQFS engine will work. My problem is that I want my blog to be of interest to three different groups of people. Those who are curious about how games work but don't want to actually make games themselves. Those that want to make games but are just learning how to program. And those who know what they are doing. All three groups require different levels of detail so trying to please all three groups is not an easy task. So what I am going to do is focus primarily on the second group with a hope that I can make things interesting enough that the first group can skim through the posts and get an idea of what is going on. The third group can consider this a refresher or a drive down memory lane.

Tiles are actually quite common among games. Especially 2D games developed for older game machines and computers. In their most basic form they are simply a way of making an image out of a series of blocks. Why is this useful? From a graphics perspective, this allows you to potentially greatly reduce the size to an image. A 256 pixel by 256 pixel image requires that you define 65,536 different pixels. If you were to break this image up into 8x8 tiles, you can describe the image using only a 32x32 grid of tiles meaning you only need information for 1024 tiles.

When your machine didn't have very much memory to begin with, this was a significant savings. "But Billy, aren't you forgetting..." Yes, there is an important detail I am forgetting, but will talk about that next post.

Tuesday, July 3, 2007

Long Weekend?

Technically, the weekend that just passed was the Canada Day long weekend. The problem is that I am more tired after the long weekend then I was before the long weekend. This probably has a lot to do with the fact that I had a wedding to attend (being as introverted as I am, weddings tend to stress me out) and my sister was down with my niece and nephew. Needless to say, I didn't get any work done on Coffee Quest Revenge over the weekend, but hope to get those ten hours of work in tonight and tomorrow night, though I suspect that I will be putting in a few hours finishing off the ten hours owed on Friday and Saturday.