Showing posts with label Easter. Show all posts
Showing posts with label Easter. Show all posts

Friday, April 6, 2012

Easter Egg Hunt

I am a bit late writing this this week. I normally post my site and this blog on thursday evening as that way I can keep my friday's free. This week I ended up going out on thursday. Last week on Blazing Games, I posted the open source version of my Easter Egg Hunt game where you navigate a 3D maze in order to find a dozen easter eggs. The eggs are randomly generated. The 3D maze was generated using a very old technique known as the painter's algorithm. I was thinking that none of the techniques used in the game are overly noteworthy then I realized that a lot of the techniques in the game, while not useful when you have OpenGL (including ES and WebGL) to work with, may still be relevant if you were limited to a 2D drawing system like the HTML 5 Canvas. HTML 5 developers, at least the ones that are targeting Internet Explorer, may need to  fall back on these old techniques. This is due to MS deciding not to support WebGL.

The egg is simply a palette swapping varient. There are 12 patterns for the eggs, but the two colours that are used to draw the pattern are randomly selected. This is a really old technique that you will see in older video games where the same monster sprite is used repeatedly but given different colours so the same artwork can be used for a large number of monsters. This would be a little tricky to do with the HTML 5 canvas as I don't recall a way of changing an image's palette. I would have to look into this, but if you can't change the palette, you can use the image data to manipulate individual pixels.

The 3D maze uses a technique known as the painters algorithm. Essentially you treat the 3D maze as a series of blocks. You draw the furthest away blocks first, then the nearer blocks, and so on until you are painting the close blocks. The downside to this is you are potentially overdrawing many times. The nice thing about this technique is it is very easy to implement and the results can look very good. Of course, you aren't going to get 360 degrees of smooth scrolling movement, but it is something that can be done on any browser that supports the canvas.

It would be nice if there was a hardware accelerated 3D standard that would work on all browsers, but even if that does happen, it won't be for years. Perhaps for next Easter, I will port the game to HTML 5, though I am hoping I come up with a far better idea for an Easter game before then.

Sunday, April 24, 2011

Easter 2011

First, happy Easter everyone who celebrates it. While I was originally going to post a sneak preview of my Sudoku Generator (yes, it is in a functional state though as usual I am behind in writing the articles related to the development), the Easter bug bit me and I simply had to quickly make an Easter game. This was actually a fairly quick development as I took my Santa's Search game and my Evil Eggs games and simply merged the two. As I am the copyright holder for both games, I have no need to release the source code though plan to in the future.

The random egg generator from Evil Eggs was used to replace reindeer but this actually proved to be more difficult than originally anticipated. The difficulty came from having the inventory eggs match the pattern picked up. This resulted in a clone feature added to the egg generator. When designing the map, I opted for a much smaller 16x16 map as I felt the 32x32 map made the game play too long.

Still it is amazing how quick I was able to get this game finished despite unexpected problems. I think a lot of the speed has to do with familiarness with the source code.

Thursday, March 20, 2008

The First Snow of Spring

Today is the first day of spring so you can imagine how I felt when I woke up and looked out the window only to see snow falling from the sky. The weird thing was that the temperature outside was above 0C so the snow was melting as it hit the ground. My lawn is still starting to green up so I suspect that I will have to be cutting the lawn in a week or two.

Of course, today I posted the open source version of my Evil Eggs Easter game, as it is Easter this weekend. I know that only a handful of people bother to download my open source offerings but I still feel that Open Source is important and plan on eventually releasing most of my games as open source. Still, I come from a background of treating code as royal jewels so I do like to hold onto the source of any new games for a while. The exception to this, of course, is my Ultimate Retro Project, in which I have been releasing the source code before I have even officially posted the games. I am thinking that with Dozen Days I might start releasing the source code the same day I release the game.

Thursday, April 5, 2007

Egg on my Site

I posted a new "game" on Blazing Games today, which is what I do every Thursday evening as being in the west coast it is Friday in most of the world by the time my post is released. You will notice that I have the word "game" in quotes because this week's release wasn't really a game. With all the overhauling of the site that I have been doing I simply didn't have time to create a new game for Easter. I still have a huge amount of minor changes to make to the site yet, but all the major changes have been complete. I was just going to take my existing Evil Eggs game and release it as open source. Then I thought it might be nice to write a short article about making Evil Eggs. The only really significant thing about the game, though, is the egg generator, and that is not overly complicated. Then I remembered that when I was originally creating the game I had wrote a simple testing program for testing my random eggs. I then thought that with a bit of tweaking, it would be perfect for the release today.

As people who have visited Blazing Games and played with the egg generator have already figured out, the random eggs in Evil Eggs were fairly simple to generate. All that is happening is that an egg color, a pattern color, and a pattern are selected at random. Of course, the original reason I wrote the egg test was due to strange problems I was having with Flash. As much as I like Flash, there are still occasionally quirks that one must discover and often find ways to work around the quirk.

The problem I had with Evil Eggs was that the patterns were not working. As any Flash developer reading this already has figured out, the egg is made up of a group of layers. The bottom layer is the basic egg movie which holds a color for the egg. Over that is another basic egg movie of a different color that has a mask applied to it. The mask causes only part of this egg to be shown, resulting in the egg. There is also a light layer to add a bit of a glint to the egg.

The problem is that masks, at least when compiled for Flash Player 7, are not always accurately rendered. In particular, any mask that has a hollow portion within the mask area will not render properly. This quirk resulted in some of my masks not rendering properly resulting in rather strange looking eggs. The solution to this problem is to simply make sure that there is a open path that will lead to the gap within the mask. For instance, my checkerboard pattern actually has notches cut out of the corners, and my O shape has a hairline crack in it.

So, if any Flash developer is having problems with using masks, remember that flash expects masks to be solid shapes.