Monday, May 12, 2008

More Terrain + iPhone!

First off, I apologize for the long hiatus. It's been a crazy last few months, both with work and personal matters. Civilization Revolution is nearly out the door and it's been quite the challenge getting it there but I finally have some time (and motivation) to update the blog.

Picking up where I last left off last time, the terrain demo is pretty much complete. By just adding some simple frustum culling to the quadtree node traveral, performance is now exceptional across the board (especially when you take into account how much detail is being represented). I also implemented geo-morphing so the transition between different levels of the heightfield is more pleasant and not so jarring. I implemented it pretty closely to how I said I would - I offset for each sub-node into the parent node's heightfield, store that off as delta's in the vertex structure, then interpolate between that and the real vertex position at specific points based on the error metric. Once again I'm pleased with the results.

I don't plan on using the terrain for the Pony Express project anymore - the project scope when taking the game design into account are too divergent, but I do plan on extending the terrain engine a bit more one day. One thing I would love to add is storing off the different levels efficiently into file archives of some kind and streaming them in on demand. Right now when I load in all the different levels for a 8092x8092 terrain at 1024x1024 lowest level detail I very quickly run out of video card memory. The solution I'm thinking of would load the previous, current, and next levels and load and unload on demand as the levels move up and down. Wouldn't be too hard to implement but would take some time, which I just don't have much of lately. Too many other interesting projects to work on!

Speaking of that, over Christmas break I finally broke down and picked up an iPhone. Outstanding little gadget, if you can stand that your phone might crash occasionally, hehe. A few months back as some of you may recall apple announced its plans to roll out an official SDK with an official storefront for deploying applications that developers make (well, as long as you pay the $100 fee and follow the rules, ha). Well soon after the Beta for this SDK was released (along with the Beta for the 2.0 iPhoneOS update that enables custom software), guess who was lucky enough to land a spot! Yep, yours truly! So for the past few weeks I've been spending a lot of time learning as much as I can about developing for the iPhone, and I must say, it's been an absolute blast!!

The device itself pretty much just runs MacOS X which is not very hard to learn at all. ObjectiveC is also pretty easy to pick up since it's a simple OOP layer over C code. I actually somewhat enjoy the syntax - it's very explicit, which makes for reading old code very easy. Writing new code is a bit more burdensome which makes me wish Xcode (the iPhone development environment) had something like VisualAssist to help with code completion. I'm just being nit-picky though. The entire process is very streamlined and easy to pick up.

Outside of a few practice apps, my first real project has been to develop a multiplayer Blackjack game, fully utilizing almost all of the phone's unique features. I won't delve too deep into the features but under the hood one thing I decided to do to simplify the entire process was write the entire application using the MVC (Model-View-Controller) paradigm, with the View currently being represented by a simple Win32 console application. This allowed me to concentrate on the core functionality and eventually migrate to something that conforms to apple's user interface guidelines using the iPhone graphics libraries (Quartz or via the Cocoa programming environment).

The core functionality is nearly complete but I've been spending a lot of time refactoring the networking code. The main reason for this is that I plan on representing a large number of games either on a single or distributed type server. The idea right now is that a user logs on to the master server which itself maintains a list of table servers. The bandwidth requirements for a single table (of 5 players max) is very small, so a table server might hold from a few dozen to possibly hundreds of table's, depending on bandwidth requirements. Distributing the load is something I'm trying to work out right now and while the logic is not too difficult, engineering an efficient and easily maintainable (and extendable) system to do this is no cakewalk. Maintaining persistent stats across server boundaries is also a challenge and it also needs to be seamless to the end-user so as they browse for a table to play on they can't tell that they may be joining a different server.

All in all it's an incredibly fun experience unlike anything I've ever worked on. My only regret is that I didn't get it finished sooner since I would have loved to submit it to the Apple Design Awards of which the deadline is unfortunately today. Ah well, maybe next year.

After finishing up Blackjack Touch, I'm going to look into a health and fitness application I've been wanting to write for a while now, then maybe re-visit the Pony Express idea with mobile gaming in mind. I think it would work really well as a turn-based strategy game, kind of like the board game feel I originally envisioned for it. Because the iPhone is intended for short spurts of usage I think that makes the most practical sense for the kind of games it will have. I just don't see people sitting around for long period of time wearing down their batteries on something they need to receive phone calls on. In my opinion, short spurts of simple yet enjoyable gameplay with clear and concise goals is the way too go!

Alright people, take it easy.

No comments: