Google App Engine Exploration
As usual, I've found yet another technology that peaks my interests and I'm exploring it. This technology is Google App Engine and is powered by Python. So far, my thoughts on it are 'Wow, thats cool!'. Google opened up the flood gates on 5/30/2008 (or 5/29?) for public beta testing and so I immediately signed up (after sitting on the waiting list for a closed beta invite for a week or two) and registered three applications. I registered three right off the bat simply because it took me so long to find an available name for the one i wanted to 'play with', so I registered all three of my alloted application names right away.
My 'exploration' project is simply called 'Zero Point', as in 'There really is no point'. You can view this application here.
So far, it's a simple sandbox application with a basic Django template. I created 'master.html' and 'content.html' templates, 'content.html' simply extends 'master.html' -- so my main page layout is contained in 'master.html' but I render 'content.html' currently -- spiffy, eh?
I also tied in a simple User account system, using the User API available from Google App Engine. If you access the site, and then proceed to login, I'll track your page views -- super cool, don't you think?
So, the point of this blog post is ... well, as the blog title implies, to show you a code snippet (or, a 'code fragment'), so let's get onto that, shall we?
I was trying to figure out how to make dynamic URL's, so that I could build out 'something' (I really don't have a plan yet, I just figure it'll use dynamic URLs) and ran into a small problem -- Google App Engine uses an 'app.yaml' file to configure your request mappings, and "- url: /.*" should match 'anything' that isn't already explicitly mapped to something else first, right? Well, that's what I thought, but I kept getting quiet 404's without knowing why ... so, I looked at the application code just a bit more and realized I was passing an explicit path into my WSGIApplication instantiation. Converting '/' into '/.*' did the trick. Now, keep in mind, all of Google's examples (so far that I've read, that is) use this static mapping of '/' for the 'main.py' and Google App Engine requires you to map your scripts in app.yaml ... so, now your stuck with mapping things to more then one place, what's the deal with that?
I was looking at an example that uses AJAX, and it has an RSS feed built into it (or something like that) and in the main() function they pass multiple URI's into WSGIApplication() one for '/' and one for '/rss' -- this is where I got the idea to pass a Regular Expression into WSGIApplication. As expected, it worked and now Zero Point can work with dynamic URL's -- problem solved.
-
def main():
-
application = webapp.WSGIApplication([('/.*', MainHandler)], debug=True)
-
wsgiref.handlers.CGIHandler().run(application)
That's the 'main' method, which just simply instantiates my MainHandler for any URL that isn't mapped to another script file -- beautiful, eh?
Harmonic Convergence Released!
Harmonic Convergence has recently been released by MrJoy, and I thought I'd toss it out there and let some people know. And yes, I'm only blogging about some 'random game' because it's not 'so random' on this blog since I helped a little (as in microscope required to see the detail) with the games development.
I'm credited under 'Menus' and 'Networking', ... now, both of these credits make it sound like I did 'something cool' and your more then welcome to give me more credit then I deserve just by thinking whatever you want ... but, in all honesty, I did very little ... still, it's the first time my names been published in a game's production credits so ... I thought I'd make a little noise.
The game is sort of tetris-like, in that it's a strategy game based on falling blocks and matching ... however, it's an interesting twist on the idea and I think MrJoy pulled it off very well. The art is stunning, and the sound track is amazing, yet another great Indie release.
Here's a video of the game in action, check it out and let me know what you think. Feel free to drop by HarmonicConvergence.net and purchase your Deluxe copy today.
XNA Code Generator for Tile Studio 2.55
Playing with XNA yesterday made me wonder how easy it would be to build a Tile based game, such as a 2D 'walk around' adventure game (ie; Zelda, or the likes). I downloaded a copy of Tile Studio 2.55 not too long ago and have been staring at it's icon on my desktop for quite some time now.
It came 'out of the box' with a handful of nice code generators, and it even included a .NET code generator ... but it only supported the BooGame library, and generated Boo code.
So, I thought to myself, why not look for an XNA Exporter ... so I loaded up the Tile Studio website, and found nothing there. I googled briefly and found nothing as well. So, I started on a little code adventure and decided to build my own. Now, keep in mind, I'm by no means an XNA Expert so my method for creating the tile map in C# may or may not be 'the best' or even 'proper'. However, the map works ... and I'm happy. I started on the project around 10:20am and am now writing this post at 11:50am ... so, it wasn't "too hard" and didn't take too much time. The time spent also included learning the Tile Studio Definition language and how it worked as well.
So, onto some 'proof', here's a few screenshots:
This is Tile Studio, with my little map loaded up
--the Map is 100x100, and the Tiles are 20x20.
Here is my Visual Studio project, after performing a code generation
in Tile Studio and refreshing the project directory and including the files.
And, here is my Map rendering to an XNA Game Window.
Now, in the project files shot you might notice that there are three files highlighted. The first is the exported Tile Map file from Tile Studio, the second is the actual Map definition (Tile2.cs) and the third is a helper class I wrote that is automatically exported for you that contains the MapDefinition and Tile classes.
And, here's the best part, your not gonna believe it ... or maybe you will. To load the map up, you simply do:
-
//In Class scope
-
WatrRoad map;
-
// in LoadContent
-
// in Draw
-
map.Draw(spriteBatch);
And that's it ... the MapDefinition provides a 'Draw' method to loop through all the tiles and render them to the screen. I've not yet optimized this to store a cached copy, but I also haven't tested it with any real 'logic' yet to try building a game. You can download a copy of the XNA C# Tile Studio Definition file from here, expect updates in the future to support more of Tile Studio's feature set.
Download the Definition File Here
Download the Full Example Project Here
Currently Supported Features:
- Export Tile Sets to BMP and place in 'Content' sub-directory
- Export CS File containing all Maps
- Export TileStudioMap.cs containing MapDefinition and Tile helper classes
- Easy Map instantiation, just pass a reference to the Map's Texture2D containing the Tiles
- Easy Map Rendering, just call the Map's "Draw" method and pass the SpriteBatch
Evil Clutches ala XNA, My First XNA Game
I was speaking with a co-worker last night, and we got into the topic of game development and XNA. As usual, I took the topic and went a little overboard and decided to install XNA at home and 'go at it'. Since I recently finished the 'Evil Clutches' chapter from Game Makers' Apprentice and, also released the 'Evil Clutches Javascript' version; I decided to attempt making Evil Clutches in XNA. It was a fairly straight forward process, and required almost no reading on my part. I was able to install XNA, Launch Visual Studio 2005 and create a new project and just 'begin'.
I was actually very impressed with how simple it was to build the game, so much so that I referred to it as 'childs play' to my co-worker just after finishing up the Alpha. With that said, here's the basic process I went through;
- Step 1: Launch Visual Studio 2005 and create a new Windows Game
- Add my Art resources to the Games' Content
- Create a GameObject base class to store common information (Position, Texture, Color, Collision Detection, etc).
- Create object classes for my Dragon, Boss, Fireball, Demon and Baby objects.
- Apply basic 'render' logic to the 'Draw' method of my Game class
- Apply basic 'call object Update' logic to my Update
- Create the necessary 'Update' methods on my object classes
- Revisit the Game's Update method and apply basic Input logic (Escape to Exit, Up/Down to move Dragon, Space to Shoot)
- Add a SpriteFont and add logic to print the score on the screen
- Package it up and Write this blog post.
It really was that simple, and the entire process took me less then two hours. Seriously, I banged the whole thing out just by looking up the 'How To' references on MSDN. Now, of course, as with everything in software development the 'easy ten step process' I listed above had lots of little 'inbetweens' (actual logic, etc).
You can download the 1.0.0.0-alpha release of my 'Evil Clutches XNA'. If there's an interest in XNA Game Development tutorials, then I might write up a 'The Making of Evil Clutches for XNA' post, so let me know in the comments if your interested in that sort of things.





