Gaming Your Way

May contain nuts.

Procedurally generated backgrounds ?

Look at me using a term that'll be a hit with the search engines.

What's been happening in the world of X++ today then ? Very very little.

It's not for the want of trying, it's just been one of those days. Yesterday after posting I ran the game through the profiler as I wasn't happy with the performance, and I wanted to see what was being nasty.

It turned out it was the skybox. Lots and lots of calls to papervision classes, and they were taking the vast majority of the actual game's run time. I've had to remove the planet effect I really loved 'cause of performance, am I going to have to do the same with the skybox ?

Yes.

Annoying as hell, but I can't let the game suffer for the background. If I've made the game good enough you shouldn't even be checking the background anyway, so losing a little bit of love isn't the end of the world. So so annoying though, what the hell can we use 3D in-game for if a couple of spheres make it gag ?

Today was meant to be the asteroids > player collisions, with the plan that you'd lose energy and therefore lose a life, and eventually lead to a game over. Once that's in, the game is a complete game, until then it's just a demo.

First step on this road was designing an energy bar. Firstly I wanted a lcd style display around the lives, where each element would "power-down" as you take a hit. Tried it, and it look toilet. Next was a plan about having some sort of arc around the lives and use a mask to show the energy being reduced. I just couldn't even face starting to design that, as I just knew I didn't have much art in me today. Next up was a simple bar effect, inspired by Wipeout Pulse's speedometer.
Looked crap. All the blend mode effects I tried on the score / lives numbers also looked crap.

Some days you could make Angelina Jolie look bad.

In desperation I ripped the energy bar out of Orbs and tinted it. Looks great. There's nothing especially creative about stealing ideas from yourself, but that's the way it goes some days.

After that, the collisions and all that goodness weren't really going to happen, my spirit has been broken. So instead, it was time to sort out the backgrounds after removing the moving skybox.
Without any movement I figured the way to go was to try and make them look as good as possible, like each one is a bitmap done in an art package, and yet make them random every time ( "Procedurally generated backgrounds" makes a much better heading than "Random backgrounds", and to be fair, I think the backgrounds are slightly more than just random ).

The 3D planet is used from the other day, it's spun on it's axis' so you're always looking at a random part of the planet texture, it's z value is also randomised for scaling, and I move the light source around slightly for the phong shader. Also another smaller planet is created, although it's not always shown.
After that, the skybox is spun around too.

We then grab that skybox and plot it into a bitmap ( ie, draw() ), on top of that is another bitmap with our planet(s) in. Depending on the size of the planet we add a blurFilter, a glowFilter and we tint it.

I really don't know what the odds of having two identical backgrounds are, they must really be vast, and aside from the odd "not as good as I would like" looking levels, for the most part I'm really pleased with how they look.

And... I think that's it til Monday, have a good weekend everyone,

Squize.

Comments (5) -

  • ickydime

    12/19/2008 8:45:20 PM |

    Sometimes I see large planets.  One being overlaid and blocking the majority of the center one.  Is that expected?

    I like the "procedurally generated" backgrounds besides when that occurs... doesn't quite look natural to me.  Tried it 5 times, happened 3 times.  Other 2 times the main planet was by itself and looked great.

    Good work man, even for what you think is a slow day.  Seems like you made a fair amount of progress from my perspective.

  • flashGameMaker

    12/20/2008 2:21:20 AM |

    Hi,

    Just played new version, and it works fine :), weird how I had issues with v3.

    I gotta admit I'm not feeling the control method though, I stuck with it for about 5 mins, to see if I got used to it and I didn't, so I just ended up sitting in the middle of the screen and firing in all directions I needed to. For me the problem is the vectors being added to each other, or the inertia being added to each other, so "left" won't move you exactly left, but left plus whatever vertical inertia you have, so you end up moving diagonally, which throws me off. I really think the old Asteroids, or geometry wars is the way to go control wise. It could also be that I'm an old git who just can't handle these new fangled control methods :)

  • Vex

    12/20/2008 4:24:02 PM |

    Gotta agree with people's comments about the control method, really doesn't feel right, but then I'm an old git too..

    Not too keen on this new background either, I really liked the added feeling of movement with the skybox. Have you thought about having the star background, and planets, on separate layers and putting in a parallax effect? I think that would give a nice sense of movement and be nicer than just a static backdrop.

    Oh, and why are you working on this, when you still have Thrustar to finish??? :p

  • tonypa

    12/22/2008 10:06:18 AM |

    I liked the moving background more. Didnt have perfomance issues myself but I understand it could be causing slowdown for some people.

    As about "sitting in the middle and firing", thats how I always play Asteroids games, played it exactly same way in Dos too.

  • Squize

    12/22/2008 1:54:49 PM |

    Just to recap, no one likes the control method that much, and everyone preferred the old moving backgrounds ?

    Good to know I'm heading in the right direction with this ;)

    Thanks for the feedback, it helps a lot. I've already tightened up the player movement ( There's a lot less inertia on it now ).

    Adding parallax to the background isn't going to be the end of the world, it will just mean moving 3 layers ( 2 planets and the skybox ), but I'd want the "main" planet to be central to the camera, so rather than it moving quicker 'cause it's closer as with usual parallax scrolling, it will need to be slower / fixed, giving the effect of the camera locked off on it.
    I don't know if that'll be weird for people, although the alternative is to not fix the camera to the planet, but to "infinity", which will mean that the planet will move around a fair bit.
    Also with adding movement, I'm worried the planet(s) will just look like cardboard cut-outs hanging infront of the stars, that the planets don't actually exist as part of that starfield.

    Hmmm, lots to think about, but I want to put the background on the back burner for a while, the task for today needs to be adding in the rock > player collisions and getting the gameplay elements in there.

Comments are closed