I'll start keeping a development journal for my iPhone game project. It could be useful/interesting.
The game is Wizard Tactics - or just 'tac'. The goal is to make an X-Com clone that captures the freedom and depth of the turn-based classic. Other than that, I don't have any concrete design goals in mind (How long should play sessions be? How newb-friendly?). The iPhone is an ideal platform thanks to its multi-touch interface, since X-Com was completely mouse-driven.
Why wizards? I figure this will give us the most design freedom (spells can do whatever we want) and the least art-cost. For attack-animations, we just need the wizard waving a wand, and we could probably use that for every attack or action. Healing, casting a small spell, casting a big spell, whatever - all the same animation.
Currently, I'm trying to implement the basic isometric-tile system X-Com used for its tactical mode. Some good reference shots are here: http://images.google.com/imgres?imgurl=http://www.ibiblio.org/GameBytes/issue19/greviews/ufo3.gif&imgrefurl=http://www.ibiblio.org/GameBytes/issue19/greviews/ufo.html&usg=__DzQ6_yCXGulw6duthxgnelne3Lk=&h=480&w=640&sz=65&hl=en&start=21&sig2=o0BpFsCu3Rr6_A2mJqoh-Q&tbnid=60vLSJnYz_B3KM:&tbnh=103&tbnw=137&ei=hSiSSaGJCNqhtweKhrTJCw&prev=/images%3Fq%3Dx-com%26start%3D18%26gbv%3D2%26ndsp%3D18%26hl%3Den%26sa%3DN
Speed is an issue. Each tile needs to be drawn with its own texture. There are some large pieces of ground here and there, but even then it could be charred by an explosion or something. So we need to quickly draw hundreds (maybe thousands) of quad-tiles while potentially switching texture for each one. The iPhone is fast, but not that fast for a naive implementation. Currently, my 50x50 map draws at 4FPS - unacceptable.
There's a fairly straightforward solution that will probably work: Put all tile geometry (basically, triangle-pairs arranged in an isometric grid) in a huge vertex array, and have an accompanying texcoord array. Each tile will have its own unique texcoords. Then use one giant texture (an 'atlas') to store all tile-textures, so if a tile needs to have a certain texture, just find it in the atlas and move its texcoords over to it. This should be nice and fast. You can also have a color array to modulate for lighting effects.
One issue is maybe a single atlas can't fit all possible tile-textures. The iPhone caps textures at 1024x1024. If you use 128x128 pixels per tile, you can fit 64 tiles per atlas. That's pretty good already, and you can always reduce tile-texture resolution if this isn't enough. I should make a utility, in matlab or something, to put these texture atlases together automatically.
Another concern for drawing is dealing with overlap. Currently, I sort everything from back-to-front (easy for a grid) and just draw them. I can probably use the depth buffer and avoid sorting myself - that can go either way I think. But what if you have varying depth within a tile? For example, if a wizard is on a tile of tall grass, should the blades of grass draw over his feet? The current system wouldn't allow for that. That probably will be something I'll just put up with, since giving each tile a depth-texture seems over kill. I could just go full-3D as well, but that opens up all sorts of performance issues. And plus, 2D art is awesome.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment