Post subject: What is subpixels?
Joined: 2/6/2014
Posts: 3
This looks like very important in game,what's it?
WST
She/Her
Active player (488)
Joined: 10/6/2011
Posts: 1697
Location: RU · ID · AM
Simple answer: game consoles usually cannot process float values. Thus they operate with integers, in particular, when calculating positions. For the game’s physics to be more or less realistic, those integers should represent fractions of a pixel. They are what’s called subpixels. (upd) even simplier answer: subpixel position is position inside the current pixel.
S3&A [Amy amy%] improvement (with Evil_3D & kaan55) — currently in SPZ2 my TAS channel · If I ever come into your dream, I’ll be riding an eggship :)
Skilled player (1736)
Joined: 9/17/2009
Posts: 4979
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
WST wrote:
Simple answer: game consoles usually cannot process float values. Thus they operate with integers, in particular, when calculating positions. For the game’s physics to be more or less realistic, those integers should represent fractions of a pixel. They are what’s called subpixels. (upd) even simplier answer: subpixel position is position inside the current pixel.
Really? I thought it was just that you can't display a raster graphic in less than 1 pixel interval so in other to make an object have a varied momentum, it use subpixels to achieve such. In terms of TASing, check here: http://tasvideos.org/GameResources/CommonTricks.html#SubpixelCarryover
Patashu
He/Him
Joined: 10/2/2005
Posts: 4042
Whenever you find a memory address for x or y position on screen and it looks like it's measured in pixels, look 8 bytes in either direction and if the game has subpixels you usually have already found the address containing them.
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
Editor, Player (69)
Joined: 1/18/2008
Posts: 663
Look at the Somari run (which doesn't use subpixels) to see one of the problems of not using them where they could be used. (hint: abrupt movement speed changes)
true on twitch - lsnes windows builds 20230425 - the date this site is buried
Joined: 7/2/2007
Posts: 3960
More modern consoles can also render sprites at positions that are not an integer number of pixels, in which case the sprite is interpolated (i.e. the value for a given pixel is based on the values of the sprite pixels that are closest to that pixel). This can look pretty terrible so it's usually not used unless in conjunction with scaling or rotating, where you're stuck doing interpolation anyway.
Pyrel - an open-source rewrite of the Angband roguelike game in Python.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
WST wrote:
Simple answer: game consoles usually cannot process float values. Thus they operate with integers, in particular, when calculating positions. For the game’s physics to be more or less realistic, those integers should represent fractions of a pixel. They are what’s called subpixels.
It has nothing to do with whether the console is capable of making floating point calculations or not. Subpixel coordinates are simply coordinates that have higher accuracy than the screen resolution. (Internally this can be achieved by either using floating point or fixed-point values.) If you are using integers, you could eg. have all your coordinates multiplied by 16 (and perform all calculations like that.) Then when you actually need the physical pixel coordinates on screen, you divide by 16. Old consoles can't draw at subpixel coordinates, but the reason to do this is that it allows better movement calculations (such as acceleration).