This post was supposed to come after part 2 of my game design post. However I apparently can't be bothered with that now, I've got code to write! I'm doing no less than 3 active projects. Well, those plus some brainstorming and ideas floating around, and all that outside of work, family and church responsibilities. (I'm now teaching the 6 year olds sunday school. So far it's pretty fun!)
First, I'm working with a friend on some iPhone software to control hardware that he built. He's gotten an older iPhone 3G to control a comcast cable box and his TV. So we're probably going to go into business together to sell attachable hardware that acts as a TV remote. We'll see how that goes, we both expect to make little money off of it. I think it's hobby money for him and mostly a favor from me, but if it makes enough to cover our initial costs I'm ok with that. I mean how many people can say they have helped build hardware and software that attaches to an iPhone? =) That's project one.
Project two is a bit more public so far. You may not know that Garmin opened up their own geocaching website, opencaching.com last month. I'm looking to do with it's capabilities what I intended to do years ago. When the iPhone first allowed 3rd party apps on the app store and I thought I could work with geocaching.com to make an app. What was the point you ask? I had a plan to make geocaching software that is easy and seamless to use. That doesn't require a computer. Something you can simply use when you think about it. You can prepare offline if you'd like, but no real preparation needed. Open up the app and use it. It's been pretty fun so far to do and with this project I'm feeling like I'm (finally) hitting my stride with iOS programming. Maybe I'll even port it to android. Well, probably not, but it would be fun. You know, with all of my extra time. Doh.
Lastly is the project I'm most excited about. Mostly for my geeky self, but still something new and exciting that I've never done before. Well, not anything other than plain text. That's making games.
The end goal is to take the initial design of what I and a friend came up with in high school. Slycrel. (I really need to post about that too don't I? I need a blogging secretary) For starters though we wanted to make a simple dungeon crawl. Since after some discussion we realized that to make the entire game at first... well, it likely wouldn't get finished.
So I pulled out my favorite 2d graphics engine for iOS cocos2d. There are lots of games made with this free engine already and I've used it before in some small side projects. I then found some great tutorials on how to build a world out of tiles. It turns out that there's a really cool free application that you can download to make 2d tile-based maps and cocos2d uses it. There are 3 parts to this tutorial and I followed all 3, doing some heavy modifying to the third. That was new year's day, and I had a lot of fun doing it. I now had a ninja game where a ninja went around collecting cactus roses and bird enemies flying at him. My kids have a good time with it. What's cooler than ninjas in the desert throwing ninja stars!
I then set out to do something harder. I am not content to simply make maps and levels to go through. I want the computer to do the hard work. So I set out to learn about how I would go about making a tile map entirely within the program that uses it. The initial answer was to generate some XML files that looked the same as what was output from the tiled app. I wasn't happy with that. So I did the next best thing -- I made a template for my maps in tiled, that I could use to generate in my program. I also made my own tiles with simple graphics that I swiped from some earlier slycrel projects as well as solid colored tiles to have something definitive.
After a bunch of debugging and general grumpiness, I was able to not only throw together a map, but add crude roads and trees on top of it! nice!
Uh... great! Clown barf!
I should back up and explain what the tiles are above. Blue is water/ocean, brown is dirt/earth, green is grasslands/plains, the odd half-circles are hills and the grey represent mountains. On top of these are two different kinds of roads (straight and a bend) and trees. Not particularly map-like. It's... well, random.
Really it looks like nothing, but I had my foundation. My friend and I discussed ways to do this and he found an excellent article online about something called height maps. Shortly thereafter he made a height map implementation in java and sent it my way. After much pain with 2 dimensional arrays (sorry, TMI I'm sure, but that was the lion's share of the time embarassingly enough) I finally got it working. I modified his code a bit by porting it to objective-c for use on the iPhone and made it return percentage values for the height map. I then took the above templates and used the height map we generated (as percentages) to populate the tiles based on height, or in this case, elevation.
Here, i'll give you one of the better screenshots of my efforts. It looks almost intentional!
I'll try to get around to my part 2 post here in a few weeks.
I better run, lots to do. More later! =)
2 comments:
Since I don't have an iPhone, and I'm not getting one ever in the foreseeable future (nothing against Apple in this case, just Verizon and AT&T coverage in my area), please port to Android. :) I'll test it for you.
If you buy me an android device then I'll port it. =) I've been eyeballing the android tablets actually for some time, but nothing is worth the money for me as of now. Good to see you by the way, hope you're enjoying the expansion. =)
Post a Comment