Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1075919 Posts in 44152 Topics- by 36120 Members - Latest Member: Royalhandstudios

December 29, 2014, 03:32:46 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Grid size
Pages: [1] 2
Print
Author Topic: Grid size  (Read 2164 times)
bug
Level 0
**



View Profile Email
« on: July 19, 2011, 09:21:53 AM »

Hey there...
I'm new here, but have been lurking for years, baited by awesome art and games.
So yesterday I've just started pixeling around and was to some extent content with my first result:



Now the problem that I have:
The guy is exactly 28px tall, as is the girl. Now I'm wondering if I should use a 32px grid for the game I'm starting to create, or rather a 28px grid. First one seems more logical, since it's divisible by 8 and a 'computer number', but 28 ain't that, but has a nicer look and feel to the game.

I'll be posting some playable examples tomorrow.
Logged
rivon
Level 10
*****



View Profile
« Reply #1 on: July 19, 2011, 09:41:14 AM »

The character will probably need some space for movement (bobbing head up and down when walking) -> 32px.

Edit: or make it 16px Wink
Logged
Richard Kain
Level 10
*****



View Profile WWW Email
« Reply #2 on: July 19, 2011, 09:54:52 AM »

Generally, its a good idea to keep the "grid" for your game based on values that fit in well with the overall pixel resolution. This is why most developers will stick to power-of-2 values. Most screen resolutions are based on multiples of various power-of-2 values, so using these makes for better scaling. There's also the fact that some video cards are designed to adhere to power-of-2, so that doesn't hurt either.

For the character you're describing, I would go for either 32px, 16px. You would go for 32px if you want the individual grid cells to be roughly the same size as your main character. You would go for 16px if you want the grid cells to be roughly half the size of your main character. Both are viable options, it is just a style/function choice you will have to make.
Logged
joeparrilla
Level 0
***


View Profile Email
« Reply #3 on: July 19, 2011, 09:59:23 AM »

They already covered your question, but I just wanted to add that I think that's really cool. Good job Smiley
Logged
Zaphos
Guest
« Reply #4 on: July 20, 2011, 03:40:21 AM »

I think you should just use whatever tile size works best aesthetically for you ... the technical reasons for power of two tile dimensions aren't really that significant.

(If you want power of two textures for the graphics card, just pad the texture out to the nearest power of two ...)
Logged
sorceress
Level 5
*****


Location: England


View Profile
« Reply #5 on: July 20, 2011, 04:05:30 AM »

Now I'm wondering if I should use a 32px grid for the game I'm starting to create, or rather a 28px grid. First one seems more logical, since it's divisible by 8 and a 'computer number'.

Why do we like to use powers of two?

Chapter I

Once upon a time, when CPUs run at speeds of <8MHz, sprites were computationally expensive to draw, which meant there were some severe limits on what you could animate/move on a game screen.

So to make programmers happy, something called "hardware sprites" was invented, that allowed sprites to be drawn using relatively few CPU ticks. These hardware sprites were fixed arrays of 16x16 pixels. So if you wanted something bigger, you would use 4 hardware sprites, giving you 32x32 pixels.

We don't have those limitations anymore, but part of their legacy is that we still think of 16x16 and 32x32 as being correct sizes for sprites, and 28x28 as being sinful.  Grin


Chapter II

Once upon a time, when computers had 16 colour palettes, the screen was described in terms of bitplanes. Each bitplane is a 1 bit-per-pixel bitmap of the screen, and 4 such bitplanes were superimposed to give 4 bits-per pixels = 16 colours.

Because memory is arranged in bytes, and because each byte contains 8 bits, Each byte corresponds to 8 pixels in a bitplane. It was difficult to scroll the graphics on the screen by 1 pixel because it meant splitting bytes up into individual bits, and barrel-shifting, and various OR and AND operations to produce the new image.

It was easier if background graphics was shifted 8 pixels at a time, since bytes could then be copied without needing to disect them.

So graphic tiles were made to be some multiple of 8 pixels wide (ie, 8,16,24,32) so that bitplanes could be translated easily in memory.
 
We don't have those limitations anymore, but part of their legacy is that we still think of multiples of 8 as being a correct size for background graphics, and anything else is sinful.  Grin

« Last Edit: July 20, 2011, 04:13:35 AM by Jasmine » Logged

I ain't pushing no moon buttons.
Christian Knudsen
Level 10
*****



View Profile WWW Email
« Reply #6 on: July 20, 2011, 04:27:17 AM »

We don't have those limitations anymore, but part of their legacy is that we still think of 16x16 and 32x32 as being correct sizes for sprites, and 28x28 as being sinful.  Grin

Many graphics drivers still only support power-of-two textures...
Logged

Laserbrain Studios
Currently working on Hidden Asset (TIGSource DevLog)
sorceress
Level 5
*****


Location: England


View Profile
« Reply #7 on: July 20, 2011, 04:40:06 AM »

Yes, opengl has this restriction.

But when we're working with textures, it's normal to have multiple sprites per texture, as in a sprite sheet.

To my knowledge, there isn't any loss of performance having a sprite sheet filled with 28x28px sprites.
Logged

I ain't pushing no moon buttons.
Christian Knudsen
Level 10
*****



View Profile WWW Email
« Reply #8 on: July 20, 2011, 04:56:37 AM »

I know. I was just pointing out that that limitation isn't just a thing of the past.
Logged

Laserbrain Studios
Currently working on Hidden Asset (TIGSource DevLog)
rivon
Level 10
*****



View Profile
« Reply #9 on: July 20, 2011, 05:49:18 AM »

If you're using some normal eng... Oh, I meant to say graphical frameworks/libraries, like SDL, SFML, ClanLib, whatever, you can use what you want... I seriously doubt there will be any big difference in performance.
Logged
Ludophonic
Level 2
**


View Profile WWW
« Reply #10 on: July 20, 2011, 08:44:52 AM »

Yes, opengl has this restriction.

Some hardware has this restriction still but it's not an inherent restriction of modern versions of OpenGL.

One thing to be aware of though is that texture rows on most hardware do need to be aligned in memory. It's best to have your dimensions divisible by 4 (or 8, to be really safe)  to avoid bugs.
« Last Edit: July 20, 2011, 08:58:10 AM by Ludophonic » Logged
Chromanoid
Level 10
*****



View Profile
« Reply #11 on: July 20, 2011, 03:12:44 PM »

Bothering about such things only slows your production speed. Unless you are making nextgen stuff or games for weak devices (like old cell phones) you can do as you please. Beware of premature optimization.
Logged
bug
Level 0
**



View Profile Email
« Reply #12 on: July 20, 2011, 04:42:41 PM »

Thanks for all the profound comments. They really got me thinking into the right direction, especially the ones, which go into detail.
I wanted to show a test with the different grid sizes, so here you go:
Executable test - 1.70MB

As some already mentioned: 28px grid size can be problematic because most screen resolutions are power-of-two values and thus the resizing doesn't always work as expected. You can see this if youre running the application in full screen and watch the guys eyes vary in width.
The 16px grid is too small/detailed for my flavour, so I think I'll be sticking to 32px and maybe resize the guy's legs.

Credits go to Simon Donkers for his "Platform movement engine".
If this ain't too off topic: Can someone give me a hint for a better movement engine?
And yeah... shame on me for using game maker.
Logged
Zaphos
Guest
« Reply #13 on: July 20, 2011, 05:19:49 PM »

As some already mentioned: 28px grid size can be problematic because most screen resolutions are power-of-two values and thus the resizing doesn't always work as expected. You can see this if youre running the application in full screen and watch the guys eyes vary in width.
Uh, that sounds like you're scaling the window up by a non-power-of-two scale factor -- this will cause problems regardless of whether your guy is 28x28 or 32x32 ... it's a separate issue from tile size.
Logged
bug
Level 0
**



View Profile Email
« Reply #14 on: July 20, 2011, 07:02:33 PM »

Yeah, my fault. Didn't realize it til just now. Thanks Jimmy.
I'm scaling it to 1680x1050 (desktop) or 1366x786 (laptop).
Logged
Twitch
Level 1
*


View Profile
« Reply #15 on: July 23, 2011, 01:39:17 AM »

Your dude looks cool, bug.


I reckon a 16px grid would fit that guy well. Since it's smaller, it'll let you put more detail in, and that's always nice.
Logged
bug
Level 0
**



View Profile Email
« Reply #16 on: July 23, 2011, 08:34:18 AM »

Thanks.

Here's more:

http://forums.tigsource.com/index.php?topic=167.msg588575#msg588575

But now I've got the problem of choosing between the tall 64px guy or the small 32px (rather 28px) one.
Logged
rivon
Level 10
*****



View Profile
« Reply #17 on: July 23, 2011, 09:04:55 AM »

The smaller one definitely... It has much more personality to it.
Logged
sorceress
Level 5
*****


Location: England


View Profile
« Reply #18 on: July 23, 2011, 09:05:12 AM »

I prefer the little one. Smiley
Logged

I ain't pushing no moon buttons.
Chromanoid
Level 10
*****



View Profile
« Reply #19 on: July 23, 2011, 09:58:46 AM »

I prefer the tall one. But imo he seems inferior to the small one regarding his "rockabillity".
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic