Archive

Archive for September, 2012

Clouds!

September 14, 2012 Leave a comment

My original 48 hour ludum dare game was “Escape from Cube Mountain”. This one was sort of supposed to be up on a mountain side. It didn’t really look like it, more like just a square chunk of crappy random terrain.

The new one I started out wanting to make it a mountain peak, but I had a hard time creating a valid playspace, and figuring out where the boundaries were. I wanted to keep the “reach the edge to escape” gameplay, but didn’t want it to look silly.

I tried water at first, thinking I could make it a volcanic island, but I could never get satisfactory coast areas. To be fair I’m never really happy with them in other games either.

That’s when I figured out, Islands up in the clouds! I could do 4 layers of clouds all scrolling at different speeds, and clouds are easy to make with noise and blur. I tried it out and it looked ok but the z fighting was harsh at some camera angles.

Someone suggested soft particles so I tried that out and believe it or not, still had some zfighting problems. Eventually I realized the cloud layers are flat, I can just store the Y value at every pixel in a floating point rendertarget, and use that as my softness factor. It worked great for the terrain but xna indies have no way to render avatars with custom shaders.

Here’s a shot of my avatar in a thick soupy cloud. You can see a huge coin nearby (I recently made them very big, because it’s more fun).Image

To make this work I had to borrow some tricks from shadowing.

Switching gears to shadow mapping, flashie from #xna suggested a really cool approach. Shadow mapping is all about rendering to a shadowmap from the light’s perspective, writing depth instead of the usual color.

Since we have no way to do anything but call a normal draw on the avatars, the trick is to set the avatar’s light values to very negative values so it draws solid black. This is the same mathwise as writing a very near depth, meaning that pixel will always be in shadow. This works if you are in a very convex world.

However it can cause you to shadow through a hillside, because the depth test will always pass. The sweet trick is to draw through the stencil buffer first. Then draw again with the avatar’s collision cylinder through the stencil. This sets valid depth values, or near enough that the shadow comes out almost as good as if you’d had a custom shadowmap shader on the avatar.

The same trick works for clouds. You draw the avatar to set up a stencil, then draw the collision cylinder through the stencil with the Y write shader. This lets the avatar’s plunge down into the clouds without glowing.

Where the clouds fail is in flowing into the terrain. Since they are flat they can look a bit silly when hitting the edge, and I ended up leaving it that way. Skyrim has some cool blowing snow effects that I thought about trying to do, but my experiments caused more problems than they solved.Image
I think if I had a third person or first person camera I’d have to fix the intersections, but with the topdown I’m not sure many will notice it.

Categories: Uncategorized Tags: , ,

Feedback

September 13, 2012 Leave a comment

The biggest problem I’ve had making this xbox game is not being able to give builds to friends.  That’s something I’d like to have done early and often.  Almost nobody had seen and played the game when I submitted it to peer review except for some of my younger relatives (who all loved it).

I got an experienced xblig dev to look at it, and he tore it apart.  I always imagined I would cringe and be mortified but I guess my career has taught me to see the value in the feedback.  At first it wasn’t particularly useful “this gives me cancer”, but I gradually got some useful information on what to improve.

Surprisingly it was mostly really easy stuff to fix.  I had one tough problem, and I found a good solution to that, but the rest of the list were all ticked off in a couple days.

The tough one was the enemies in a linear chase tend to pile up on each other.  I had tried a few solutions in the past and they all murdered the frame rate on the xbox.

One simple solution came to me right as I was drifting off to sleep.  I figured out that I could have some of the cubes “lead” the player and try to cut them off, and others chase more directly.  I accomplished that with a random sbyte value stored in the already small-as-I-could-make-it enemy struct.  The random  value is set once on initialization and it gives that enemy a semi-unique behavior.

It’s kind of beautiful, or would be if they weren’t trying to beat you down.  It also keeps them somewhat spread out, but still allows you to gather them up to blast them with area spells if you keep them close (the lookahead value scales off as distance approaches zero).

So I have a few days left before I can resubmit.  When I originally submitted, I think I was “done” with it.  I couldn’t really think of anything more to add.  Showing the game to smart people with good feedback has given me a lot of good ideas, so I’ll be working on it a few more days.

Chomping at the bit to start on the “nextgame”, but it can wait a bit.

Categories: Uncategorized Tags: , , ,

The ‘Extra’ Stuff

September 7, 2012 Leave a comment

I’m about to release my first fully solo game on xbox indies.  I’ve done three Ludum Dare games now but a real commercial product is a bit more difficult.

It really has given me as a programmer more appreciation for the other disciplines.  Designing a logo and box art is really tough, as is music, as is UI design.

I’d estimate I spent about ten to twenty percent of the development time on the actual “game”.  The systems and code that move and cast spells and handle buying stuff and researching and making.  The rest was all the stuff I usually push off onto someone else.  Very important stuff, but stuff I am not yet good at.

I completely failed in two areas.  The logo and music I had to get help on.  My efforts on both were so incredibly bad.  For music I ended up buying some royalty free classics.  For the logo I spent several days researching and trying new ideas and running them by IRC people.

All of the advice was contradictory.  You get a lot of design sites that have rules like “never use outlining” or never do shiny stuff, or gradients are unprofessional.  Then I look at games that sell and they have all of those things.  I think this is one case where going out and doing research actually left me worse off than when I had started.  Art and design are so subjective that I can understand why there are no hard & fast rules to follow.

Categories: Uncategorized Tags: , , ,