Tuesday
Jan272009

Top Down vs Isometric or Both


Volcano Storm XNA game 012709 from Allan Chaney on Vimeo.
I've been struggling with perspective.  My original intention was to mirror my work on Paladin's Legacy and just create a Top Down game.  The problem I've run into is, due to the current state of game graphics, even the simplest graphics don't look good in pure Top Down.  It's very hard to convey depth in top down... much harder than I thought it would be.  Back in the day, graphics were so simple, depth didn't matter.  Now it does.  Some things work but most do not.  For instance, my player looks like a spider running across the screen in Top Down as you can see from my first video.  (Admittedly, there are only 2 frames of animation for each direction so he looks pretty choppy.  But until I have a fully sculpted 3D character, there's no point in going through the painstaking task of texture grabs for each direciton times 16 or 20 for smooth animation.  I'll wait to do that once I have a character worth animating.  I'm still learning ZBrush.:-)    My volcano looks acceptable but I'm unable to recreate any depth with mountain terrain in Top Down.

Here is mountain terrain, a tree and a burnt tree in top down.  The mountian is just barely acceptable but not really.  The tree and especially the burnt tree look aweful.  The burnt tree doesn't even look like anything.  At least the green thing could be mistaken for a bush.  But no one would think that black thing was a tree.

mountain2topdown

treetopdown

 burnttree1

 

 

 

 

 I decided to go for isometric but apparently I'm not smart enough to figure out the tiling for isometric.

I did some searches online and found a few sites but nothing that came even close to just laying it out in C#.

And that's the problem.  I need to see a code example in C# preferably using XNA to create a 2D isometric scrollable map.  Of course even if I could recreate that isometric tiling code in my game, I would probably lose my cool 2D camera that I spent a lot of time getting to work.

So I think I'm going to shoot for a Top Down/Isometric game.  My world will be a Top Down Tiling scrolling backdrop.  But the objects I place in the world will be at varying angles relative to 90.  I have a tree at -45 at it looks pretty good.  I rotated my Volcano and the one mountain I have to -20 degrees and I like them.   I'm referring to the z axis regarding degrees.  This is the huge advantage of creating everything as 3D models.  It takes some time but once you have the model, it's fairly easy to reposition the object and do a texture grab in any angle or position.  

So now when you zoom out you can see the mountain peeks extending above the tiled world map.  I think it looks pretty cool.  I had to spend some time getting my Volcano Rocks to come out of the top of the Volcano instead of from the center of the Volcano rectangle, as they did when my volcano was top down.  I also had to add a Y based arching effect combined with scale to make the rocks look like they go up, up, up and then down.  I'll keep tweeking that look.

I have several issues with relative scale of objects and the size of my textures.  Microsoft is limiting Community games to 150 megs.  I never thought that would be an issue but just my mountain alone is 1.4 megs and my little project is already over 50 megs right now!  Granted all of my game textures are larger than needed but that's on purpose so when I scale in or out everything still looks crystal clear.  At some point I'll have to make some decisions about clarity while zooming vs. texture size.
Wednesday
Jan212009

It's not a game yet. It's an XNA tech demo learning project.

Wednesday
Jan212009

Making Trees in ZBrush 3

blogtree1So I finally made a decision regarding graphics applications for XNA game building.  I bought ZBrush. The interface is a little non-standard but what I really liked about it when I first started the trial was that you can start with a 3D object and just start sculpting and changes occur real time on the screen.  No "click render to see what you have just applied".  It also takes a very artists approach to 3D model creation.  Which means...it's not like other 3D modeling programs.  (It's actually 3D and "2.5D").  If you are starting from scratch, I strongly encourage you to watch the video tutorials at ZbrushCentral, ZClassroom.  The interface is something you can't learn through trial and error as hobbyists are prone to attempt.

I've been struggling even within Zbrush to create realistic looking trees.  

First TreeIn this first attempt, I just sculpted everything.  I started with a 3D cylinder and moved and stretched to make the trunk.  I applied a material and painted on a texture.  Then I added a 3D cone and pulled and stretched, texture etc.  I used the Subtools features so I would have two separate pieces I could work with.  Here is a link to how to use subtools in ZBrush.  Ultimately I want my player to be able to walk under the tree canopy and have the canopy go semi-transparent.  So in game, I need the trunk and canopy as separate graphics textures.

I angled this forward 65% using deformation and dropped it into my game and I didn't like it...at all.  It looks too nintendoish.  So back to the Internet for some tree research.  

After about a week of digging through tree stuff, I finally found the Stanford Dryad project found here.  The beauty of this is it's an academic endeavor and the license allows totally free use of the trees you create/use in commercial applications.  The magic is you can export your tree in .OBJ which is the import format of ZBrush.....Magic!

In 10 minutes I had a tree exported from Dryad in .Obj.  Use Tools, Import in ZBrush...and there is my tree model.  It's not perfect but it's a great start.  And it's 3 years ahead of what I could do on my own, having no artistic training.

Here is the Tree just exported from Dryad in .obj.  It's needs work but just try sculpting that out of clay.

treeobj

 

 

 

 

 

 

 

 

 

 

trunk11

I modified my trunk object by stretching it longer and moved it in place to cover up the Dryad Tree Trunk.  I have my original trunk as a subtool and then the Dryad tree as a subtool. 

canopy1

I applied materials, painted textures on the canopy and trunk and here is my final result.  And I tilted it forward 65% because I can't figure out how to make a tree look like a tree in pure Top Down perspective. (The game I'm working on is a Top-Down perspective game)..though I may adjust that concept now that I know what I can do with ZBrush and Trees.

My Final in game Tree.... and then Tilted.

blogtree1blogtree1tilted
Friday
Jan092009

Review Beginning XNA 2.0 Game Programming From Novice to Professional by Alexandre Lobao, Bruno Evangelista and Jose Antonio Leal de Farias

I really liked this book.  About half of the book will be valuable to a complete beginner.  The second half delves into 3D and starts you down the path of shader development, terrain generation and a third person shooter.  I found the third person shooter part to be a relief since most books deal in first person when they hit the 3D section.  I have motion sickness problems with first person shooters so I will never make a first person shooter.  I am therefore a little biased in that regards.  I didn't understand most of the 3D stuff.  So I doubt you will either if you are at my stage in XNA development, which is to say beginner.

I did however like the fact that the authors are uncompromising in their use of Game Components vs. Classes.  My understanding of the history of Game Components is that it was a feature Microsoft included in XNA in the hopes that the community would develop components that could be distributed over the web and used as a sort of "drop in" chunks of game code.   I won't explain how they work here but I will say I was thoroughly confused by them at first.  The previous XNA and C# books I read never even mentioned Game Components as an option.  In regards to C#, I think that's because they are not available in C# regular (don't quote me on that though) only XNA, and as far as the other XNA books, I think it's because the authors were not familiar enough with the concept to feel comfortable writing code using them.  In essence a Game Component is just a form of a class that works differently with the intent of making that chunk of code more modular and thus more conducive to sharing.

The authors make full use of Game Components in their very first game, Rock Rain.  This game is a real treat to code and to run.  I think the authors did a nice job of slowly progressing the building of this game.  They actually finish it in a very basic form which is good for us beginners.  Then they extend it with more powerful features like menus, game networking, health ups, progressing difficulty etc.  That helps to keep the complexity low in the beginning and it gives you a sense for how you can organize your code using game components.  I actually used their rock code structure in my first project.  Instead of rocks falling down the screen, I have raindrops.  And I used a class instead of a game component because I was more familiar with that structure from reading previous books.

It is absolutely imperative that you understand Game Components, in my opinion.  I say this because a lot of the tutorials and examples you see online use them to structure things.  If you check out the code samples at the XNA Creators Club Website , you'll see Game Components all over the place.  I am particularly fond of the 2D particle system.  I implemented this in my current project and it forced me to learn how to use Game Components.

Another piece of code I am using directly from this book is how they handle screenbounds on the Xbox 360.  You can't just declare a screen resolution like you do on a PC and expect your game to work right on the 360.  TV's have overscan, an unused area rim that varies in thickness from TV to TV.  You have to take this into account when developing for the 360 or some players will not see things you put on the edge of your game window.  The authors use the #if Xbox 360 command to separate the screen code "if" the program is running on the 360 vs. a PC.  I thought that was pretty slick.

I used sticky notes to reference key topics that may be valuable to me in the future.  Some of them were, XNA supported file formats, game components, menus, health up object and networking.

I probably would not recommend this as your one and only XNA book.  I think the Rob Miles' "Learn Programming Now!..." book is better for beginners since it only deals with 2D.   But I would recommend this book as your second or third purchase.  Just be aware that the second half may be over your head right now.  I mention a possible third because I am currently reading the new, and as of this writing, only XNA 3.0 book:  Learning XNA 3.0 by Aaron Reed.  I like it a lot so far but I'm not ready to review it.
Wednesday
Jan072009

Review Building XNA 2.0 Games by James Silva and John Sedlak

I read some of the reviews of this book atAmazon and I was pretty disappointed by the immaturity of reviewers.  But I guess that's the way it is when anyone can post whatever they want.  There was one review in particular that made the assertion that Mr. Silva was capitalizing on his winning of the Microsoft game competition where he won a publishing contract for his upcoming Xbox 360 Live Arcade game The Dish Washer: Dead Samarai, by pumping out a book.  This was a really stupid and immature thing to say.  That reviewer obviously has no idea how much effort is involved in writing a book or developing a publishable game.  And the market for these books is so small, Mr. Silva is not going to get rich on book sales.  If anything, Mr. Silva should be commended for taking the time to write this book along with his co-author, all the while, toiling away at his soon to be published game.  A year later and he is still working on that game, though I understand he is one bug from certification.  Publishing is immensely difficult.  I know just a little bit of where he is at.  When I sent my game, Paladin's Legacy, off to Sundog Systems Inc. in 1987 I thought it was done.  I spent another year getting it publishable and that was 20 years ago when code and games were much much simpler.

That brings me to my first point.  This book has a lot of really awesome code in it.  With that said, I have to fair to the beginners out there.  A lot of the code is over your head...right now.  Mr. Silva includes so much code, there isn't a lot of room left over for explanation.  At least that's the way I perceive it.  Consider that in this relatively modest book, Mr. Silva develops an entire character animation editor ("robust, ugly character editor" are his words).  It looks magical to me.  He then proceeds to develop an entire, "robust" fully realized, 2D side scrolling game.  This thing makes the Platformer example included in the Visual C# Express Editor seem ridiculously simple.  That's a compliment by the way.  Visually it blows away anything Mario has been in for the last 15 years.  That's my personal opinion.  He develops a particle system with smoke, fire, blood spray and splatters.  His character is a gun toting, wrench wielding, jumping killer.  He has AI based enemies including regular ghouls and chainsaw wielding ghouls.  There is real time collision based combat.  I could go on and on.  But wait it gets better.

I have a pet peeve with some XNA books that spend a few chapters on 2D and then jump into 3D with all guns blazing.  The fact of the matter is most Xbox Live community games will be in 2D because 3D is just massively complex.  Given graphic content requirments of 3D, most 3D games will require a team of people.

This book is entirely 2D!  Thank you Mr. Silva. 

Looking back at my sticky notes that I use as page markers for future reference, I find I marked the following:

Reading in a text file, character animation system, particle system smoke, fire, particle blood, slow-time effect(like The Matrix), shake screen, blast effect, Rumble, professional HUD, 2D Shaders!.

That's right you saw that last one right.  I have never before seen shaders used in a 2D game.  Usually when I read about shaders, I'm knee deep in 3D code way over my head.  This is the first time I have seen code, in print, that does shaders in a 2D game.  I don't understand it but when I do I will use this code.  He has several shaders; Color Filter, Blurry Greyscale, Bloom, Earth Tones (to give it a non-Nintendo look that I'm so sick of I could just puke), and the frosting on the cake...A Water Effect (rippling, reflecting water in a 2D game).  Who would have thought?  Well James Silva thought enough of the XNA community that he shared this code with us. 

I may not understand all of the code in this book now but I'm glad I bought the book because it shows me what is possible and I know when my knowledge catches up with this book, I'm going to produce a stunning game with some cool Silva-effects.

This is an intermediate level book.  It's definitely worth buying.  Be prepared for a lot of cool code with only modest explanation, that if you are a beginner has great future potential and if intermediate, should impress you a great deal.

Allan Chaney