Resolutions

Published January 16, 2007
Advertisement
I've just added in support for running in different resolutions, which you can select via the options menu. Never done that before, so this project is bringing lots of firsts for me.

The way I've implemented resolution differences is to pass a scale factor into my Device::Acquire() and Device::Reset() calls that is saved by the library.

Any calls within the library that affect screen co-ordinates (only three functions actually) just scale the co-ordinates by this factor before passing them on to Direct3D.

Simple but effective. The graphics look a bit ropey at less than 1024x768, but for a 2D platformer I think that is acceptable.

At the moment it is hardwired with 640x480, 800x600 and 1024x768 but I intend that when Udo runs first time, it will test for the availability of the three modes and write a config file specifying which are possible and by default the game will run in the highest.

If, at any point, the game fails to acquire a graphics mode that this file tells it it should be able to acquire, it will modify this file so that the first time bit will run again next time you run Udo. This will protect against the user changing graphics hardware or drivers after Udo is installed.

That's the plan, anyway. Got so many features now, I really better write some kind of game for them to apply to [smile].

[LATER]

Spin attack is now working and is pretty cool. You now have to spin attack to kill enemies rather than just landing on them.

You press down when you are in the air and Udo drops quickly and spins round quite quick. Bit hard to describe really, but feels really solid and fun.

Next up is destructible blocks that you spin down onto to destroy. I'm not too sure how to do the destruction effect at the moment so will have to experiment. I'm quite tempted to have glass blocks that can be destroyed since a) it makes a certain amount of physical sense, b) they are easy to make look good with alpha blending and c) I can't remember another Mario style game that had glass blocks you could smash (sure someone will correct me [smile]).

[LATER STILL]

Well that was a success. Smashable glass blocks in and working, another fine freeware wave sound sourced and a pretty cool effect as they smash really.

Here's a short demo video of the glass smashing in action.

Rotation is really bringing this game to life. I'm doing the glass smash with a standard starburst of particles, but the particles, which in this case are just alpha-faded blue triangles, are spinning as they expand and it creates a pretty nifty smashing effect with just one static frame in terms of resources.
Previous Entry Texture co-ordinates
Next Entry Hmm
0 likes 6 comments

Comments

LachlanL
Hey. Just a thought, but you might want to start specifying your coordinates in fractions-of-screen-width. That way the resolution you run in won't make any difference. Might be too late in the process to do this though [smile].
January 16, 2007 02:28 PM
Aardvajk
Good thought, but if I'm thinking right (probably not [smile]), that would produce exactly the same results as just dividing a virtual screen co-ordinate by a scaling factor, wouldn't it?

Plus I'd have to deal with fractions and stuff everywhere in the game that I have co-ordinates. With the system I've built into my library, I can just decide on an "optimum" resolution for the game and write everything as if it was running at that.

The conversion down to the actual resolution is then done in the library and apart from supplying the correct scale (which is just Virtual Width/Actual Width) I can forget about it.

Wouldn't cope with widescreen monitors of course.
January 16, 2007 03:28 PM
Todo
Haha, the last screenshot really leans towards a "drunk driving" powerup :-D (especially if every tile swings back and forth)!

As for screen resolutions: there are lots of ways suited for this task and yours will probably work as well as any other. The only difference should be "where" and "ease of use". For example, a technique I always use is to anchor the projection matrix to an orthogonal 640x480 transform and just set the viewport to the chosen resolution. This way, all coordinates will lie in a fixed coordinate system, and will automatically scale to the size of the viewport. The method you use is also used in Quake III Arena to render the GUI/HUD for example.

The movie rocks...

EDIT: (probably nostalgia playing up again) can you make the sheep jump slightly up from time to time? As if they were hopping (is that the correct term?). It doesn't have to have any practical meaning. It adds of bit of "cuddlyness" before you snap their backs.
January 16, 2007 06:01 PM
Aardvajk
Quote:Original post by Todo
Haha, the last screenshot really leans towards a "drunk driving" powerup :-D (especially if every tile swings back and forth)!


Yeah - I don't think I'll be able to resist a spinning level at some point. [smile]
January 16, 2007 06:06 PM
Iced_Eagle
A spinning level would be sweet. Add a pair of gravity boots as a power-up so Udo can stick to rotating tiles and you can get quite a fun challenge jumping from block to block as they are rotating!

So Udo can no longer jump onto sheep to kill them but must do the spin move?
January 16, 2007 10:12 PM
Aardvajk
Quote:Original post by Iced_Eagle
A spinning level would be sweet. Add a pair of gravity boots as a power-up so Udo can stick to rotating tiles and you can get quite a fun challenge jumping from block to block as they are rotating!


It's a lovely idea, but a bit beyond this project since it would require collision detection to work with arbitrary angles rather than squares. Maybe in the sequel [grin].

Quote:Original post by Iced_Eagle
So Udo can no longer jump onto sheep to kill them but must do the spin move?


Yep. Works pretty well and at least differentiates this from Mario a bit.

Although I have just tested on my work computer and the world map is ever so slow. Seem to be dropping a vsync each frame. Guess I'm drawing too many blocks. Have to address this later since this computer is fairly fast.
January 17, 2007 02:34 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement