Monday, May 12, 2008
More Terrain + iPhone!
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.
Friday, September 14, 2007
More happenings...
The first thing is a new game idea I cooked up a few months ago. It basically started as a game design exercise I started for fun but has bloomed into a pretty fleshed out design with a complete design document in the works and a small proof-of-concept prototype. The high concept is this; Build and manage the Pony Express from the ground up.
The setting obviously is the old west, specifically around 1860 in the United States of America western territories. I won't go to much into the history of the Pony Express, but it's story is truly an amazing tale worth reading about (I recommend this book for anyone interested).
The game takes place in "real-time" over the entire span of the Pony Express which was a short 18 months (after which the telegraph reaches the west and the game ends). The goal of the player is to hire experienced riders, buy horses, build routes with relay stations and home stations, and ultimately try to win delivery contracts from different municipalities, and ultimately, the U.S. government (a goal the original Pony Express was never able to fulfill). The west however is not without it's many perils and the player must be careful to protect his routes from many dangers like Native American unrest, outlaws, blizzards, storms, and wild beasts.
While certain aspects of the game will be historically accurate, the main emphasis is on simple yet thought provoking gameplay with infinite replayability (I highly regard Introversion's DEFCON for their achievements of these qualities). To allow for this the world is relatively accurate to what it was back in the 1860's with many cities and all states and territories left intact as well as the emigration trails existing as a starting point for the players routes. The player is presented with a map of the 1860's United States and from here is able to manage and build his mail delivery empire.
It's all still in the planning phase and I may or may never actually implement the design but even so it's fun to work on a new idea (it seems like all I've been working on at home the past few years is Star Trader). Here's a few screenshots from a quick little terrain prototype I came up with for the country map:
Here's another shot with some vector rendering I've been working on (for showing state borders). And yes, that _is_ Florida overlayed over California. :-)
The second exercise I've been working on is related to my cop game idea (Justice). The story basically revolves around two men with very similar backgrounds who end up diverging towards very opposite sides of the law. One is young and idealistic and decides to join the police academy after at a young age he witnesses his father being murdered in cold blood. The other cynical and broken after surviving a difficult childhood on the streets finds acceptance and importance in the criminal underworld. Both will eventually meet and come head to head in a tale of revenge, murder and ultimately redemption.
That's a brief synopsis, but what I've been trying to do is make the story mirror a bit more some of the work of Joseph Campbell. Specifically the hero myth (or monomyth) story structure. There's basically a number of stages that such a story must use, like the call for heroism, the tests and tribulations, the boon etc... If you're interested I definitely recommend finding A Hero's Journey by Campbell.
What I'm tring to do though is take the base skeleton of the story for Justice and see if I can mold it into a hero myth. The "good" guy character for instance joining the force after his father dies would be the call to adventure. The trials would be his time at the academy and first days on the job, continuing on with his success, or perhaps wrapping back around with another call to adventure (like through a promotion from patrolman to detective). Achieving the goal would ultimately involve solving the murder of his father and the admiration of his peer's (the reward).
I still have a lot of work to do but I think it can definitely help to craft a more interesting story. An example of a great implementation of this story structure would be the Matrix. A few weekends ago I picked up a new sub-woofer for my entertainment center (a Martin Logan Dynamo fyi) and decided to put in my favorite movie, The Matrix, for a test drive. So as I'm watching it I started realizing that it exactly follows the Monomyth structure. For instance, in the Monomyth, the hero first must have a call to adventure. The Matrix has multiple instances of this. The message from Trinity to Neo's computer. The Cell Phone delivery at his job. The red pill or the blue pill. All of these things draw the hero into his quest despite his initial reluctance.
Next the tests or trials. You can take these either literally or figuratively. When Neo fights Morpheus. The roof test. Morpheus' rescue. His first fight with an agent or more importantly with Agent Smith. In each of these Neo either succeeds or fails, but either way his quest continues.
Next the hero achieves his goal or "boon". Trinity's profession of love to him. His death and ascendancy beyond the rules of the Matrix. These things bring important self-knowledge to Neo, specifically in that he is indeed "The One".
Next the hero returns back to the real world. This stage requires little explanation except for being out of order perhaps (Neo returns from the Matrix to the "real-world" multiple times throughout the film. :-)
Finally the hero applies what he has learned. The destruction of Smith. His warning to the powers that be. His Super Man flight. Neo has now learned of his true potential and will go on to use his power's towards freeing the rest of humanity that are still imprisoned in the Matrix (a perfect segue into the disappointing sequels).
In some ways I think the Wachowski Brothers were greatly influenced by George Lucas' interpretation of the Monomyth. The Wachowskis so accelerated the process though that they ran out of room to develop the myth, resulting in two horrible sequels (as opposed to Lucas' 3 horrible prequels). ;-)
Alright, I'm out. Later everyone.
Friday, June 29, 2007
The REVOLUTION begins!
The game is set to be released next spring so everyone will have to wait a bit longer before they can play it but there's an announcement trailer floating around along with some concept shots (like here). In-game screenshots will probably be released within the next few weeks, which is very exciting since that will actually show off some of the work I've done related to rendering and general graphics work. The game is looking phenomenal and I think will definitely surprise some people who thought a studio like Firaxis couldn't pull off the next-gen look.
All in all it's very exciting to finally be able to talk about what I'm working on. It seems like so often everything I do is cloaked in secrecy. From one project to the next, I get maybe 6 or 7 months where my friends and family can know what I work on, then on to the next 2 year (on avg) secret development cycle. I suppose in modern times it's a necessity in order to avoid over-exposure (ehem, Duke Nukem Forever anyone?), especially on a game like Civilization that's constantly being tweaked and relies so much on iterative design to ensure the most balanced and enjoyable gameplay.
So even though the past few weeks have kept me very busy at work, I've still had a lot of time to get a lot done at home. I've taken up collecting Star Wars: CCG cards again, which is unfortunately quite an expensive habit (seeing as they haven't been made in years). It was probably my favorite card game growing up (more so than Magic: TG) and even after all these years impresses me with it's strategic complexity and depth.
I'm also really enjoying playing with the adorable little puppy we got about 2 weeks ago. It loves to keep me up at night which is just great... yeah. She's a miniature schnauzer, and incredibly cute, but, ugh, getting a new pup takes a lot of initial effort.
As far as Star Trader work, most of what I've been working on in the past few weeks as been conceptual design work. The combat system is almost completely planned out and just needs to be implemented. I have a document that's something like 20 pages long and goes incredibly in-depth into all the space combat specifics. The last remaining detail actually involves interface design and how a bigger ship's weapons will be fired by the player (for instance, the turret hardpoints on a capital ship as well as any energy beam emitters and torpedo launchers). I'm trying to keep things as simple as possible while still keeping the player involved (via tactile interaction). This means I'm shying away from automated firing but I think this may come back to haunt me.
I've actually gotten quite a bit of code work done as well. In the past few weeks I completely integrated the new very efficient font and gui element (quad) rendering I had prototyped a few months ago back into the main engine codebase. I can now basically render the entire GUI in a single draw pass if I setup my textures intelligently (by texture atlasing for instance).
I also completely revamped my entire GUI system to use xml. It supports a brand new animation system and uses a much better skinning solution which relies upon a few layers of abstraction to reduce complexity. A GUI file defines a layout and a skin. A layout once finished should never change and contains all the windows with the different gui controls that represent any given user interface. The skin file however contains control templates and properties, which define the look and feel of the GUI and can be changed at will. I have a feeling I'll probably be working on all of the layouts and templates and eventually when I get an artist to help out (hopefully sooner than later), he'll be swapping out new art and assets in the property files.
The other thing I finished was adding support for the 360 controller to the game. I recently purchased a wireless Xbox 360 controller and PC wireless adapter for this purpose. It's actually a great controller and works great for playing some Tie-Fighter or Freespace 2. So far I've only implemented controls for the new GUI stuff I had been working on but the plan is eventually allow for complete control of the game through the Xbox controller. Now I'm not of the mind that all game genres perfectly translate to a gamepad controller (first person shooters for instance will NEVER play as good as a mouse/keyboard combo), but I think that Star Trader really is perfectly suited to allow for all levels of control strictly from the gamepad. I actually think it may work even better than the mouse/kb and have a lot of great idea's about how to make the player interactions with the controller completely seamless requiring almost no thought. I'll have more details about this at some point but don't worry, I'm definitely planning on keeping things as simple and straight forward as possible. This situation is certainly something I plan to avoid.
Another thing I had been playing around with is screen-oriented billboard line drawing, which I plan to use these for lasers and exhaust trails (think Homeworld). Although the basic implementation is complete, there are a few issues I still need to work out. Basic laser projectile code is up and running though but I really need to get the ship combat system back up and running. It's been down for a few weeks as I've been revamping my entity management and zone systems. I basically NEED to finish my zone system by next week or progress with the game is going to be completely stalled. I have some idea's about how it should work but right now I'm trying to figure out the best way to implement it with the least room for programmer error (i.e. where's entities aren't accidentally placed in the wrong zone, or objects render incorrectly because of wrong zone ownership).
Alright, that's all I've got for now. Have a good one! Later!
Tuesday, January 9, 2007
Star Trader Planetary Combat

"A new life awaits you in the off-world colonies, the chance to begin again in a golden land of opportunity and adventure..."
In Star Trader Online, planets are the most valuable resource you can possess. Owning a planet conveys numerous benefits, but an empty planet is next to useless. For a planet to be useful, it must be populated. In order to do this, the player must pick up colonists from the greatly over-populated Earth, where billions of souls await a fresh start amongst the stars. Once a planet the player has claimed is colonized, the player may assign responsibilities to the colonists. These tasks include ore mining, farming, and fuel manufacturing. This is where the real benefit is; it's production capabilities. Colonies may even be taxed. It's because of these benefits that planets are so sought after, and in time the planet can be upgraded for even greater production through buildings. Although travelers may trade with a planet that is claimed by another person (if landing is allowed by the owner), in some situations it's more beneficial for him to take that planet as his own.
After breaking through a planets initial defenses (like planetary shields), a planetary invasion may commence. There are two participants in a planetary invasion, fighters and marines. Before the ground combat may begin, the space marines must land on the surface. The marines start out high above the planetary city to the left of the screen in their drop ships, which slowly descend towards the surface. If there is no star fighter resistance, they drop rapidly, otherwise air combat commences. If the attacker has no fighter escort, the drop ships are sitting ducks and easily destroyed after only a few hits. If a fighter screen is present, however, the attacking and defending fighters battle until either side has no more fighters. If the attacker destroys all the defending fighters, the drop ships drop rapidly and ground combat begins. If the defender destroys all the attacking fighters, they can then begin their attack on the drop ships. If all the drop ships are destroyed, the invasion has been thwarted.
Once all the drop ship reach the ground, their hatches drop down and marines pour forth firing upon the awaiting defending marines. The conditions that dictate a marine units effectiveness include it's rank (regular, veteran, elite), it's tech level (primitive, average, or advanced) and any of the attackers special skills (like the planetary assault skill, which is earned after a number of successful planetary assaults, or a player having the planetary assault proficiency trait). Once either side has no more marines combat is finished and the winner gains, or maintains control of the planet.
A couple of extra details about planets and their design rationale.
Planet growth: Planets populations can slowly grow over time but require food to do so. Some planets can produce food, some can't. Planets that can't produce food will never grow in population until there is an excess of food, which tends to set food prices to a premium. This can create quite a lucrative situation for clever traders. In some cases it may be beneficial for a player that owns such a planet to offer subsidies to other players to encourage them to supply their planet with food, ensuring it's growth and increased production.
Planet sizes and populations: Planets come in small, medium, or large (ex: pluto, earth, jupiter/neptune). The size is used to determine the maximum population a planet may hold in the millions, which are represented as population units. One population unit equals one million people. As an example, a planet with max size of 4 population units may hold at most 4 million people. The lowest measurement of population on a planet is one thousand people, so 4 million people would actually be represented as 4,000 k (four thousand thousand). However, only whole population units can be used for production, as opposed to fractional population units. This means if the population was 3,900 k, only 3 pop units could be allocated.
For a standard ship, a single cargo hold can occupy 100 k colonists (special ships like the pod/seed-ship can hold more). So for a ship with 10 holds, a size 4 planet would take 4 trips to fill at 1 pop unit per trip (4,000,000 / (100,000 * 10)).
And that’s planetary combat (plus a few extra tidbits). Next time, the new star ship combat is explained.
Monday, January 8, 2007
Models and skeletons and formats....
I've started implementing matrix palette skinning on the CPU but I plan to eventually use the GPU for the task. Before then I need a good plan in place for the shaders that will require variable bone indices. I'll probably only support 1, 2, and 4 bone indices, but that would require up to 4 versions of each vertex shader (that's including the 0-bone version). Something else I need to consider soon is adding pre-calculated silhouette edges to the model format since I plan on doing stencil shadows at some point. Sure I could calculate them at load time but it would be just as easy to pre-calculate them and directly load them from file (and much quicker as well).
As most people know, Microsoft OS's start to crap out and get flaky after about 6 months of heavy use. Well I've had the same install of Windows XP on my current machine for nearly 2 1/2 years now and I was well overdue for a clean sweep. It's not usually a painful process but I decided to do a very thorough wipe of my hard-drive using DBAN. This took quite a while but honestly not as long as it took to back up all of my critical data onto disk media and my backup hard-drives. So since most of the process entails waiting I had a lot of time to think about some design aspects for Star Trader. I think I've basically worked out all the details for ship-to-ship combat as well as planetary ground combat. I've got to run but I'll describe it in my next update.
Later!