A Question about pixels

Monkey Forums/Monkey Programming/A Question about pixels

Sensei(Posted 2013) [#1]
I'm a huge retro fan (as can be seen in our games), but my question to you is this:
I am starting a new shoot-em-up game, aiming for all the Monkey targets possible, ie Mac OS X, Windows 7/8, Android, Ouya and Linux.
Since Monkey has this awesome Scale function, I've been looking at getting the best configuration of quality and pixelly-ness for the look and feel for the game.
I've tried Scale DeviceWidth()/320.0 and 640.0 so far and normal unscaled full resolution.
Thing is, at the 320 virtual resolution, the pixels look quite blurry due to the scaling (obviously). They look less blurry at 640 but to get the look I want, I need to double the pixel size I draw in, ie 2x2 pixels = 1 pixel. (Hope that makes sense). That 640 and pixel doubling combo seems to give quite a good combination of visual feel and scaling middleground and also looks sharper.
However, since I'm going to do all the graphics at whatever resolution I finally decide to wotk on, I was hoping some of you could suggest a better way of doing it.

Here's some examples of the look and pixelly-ness I'm going for:
http://tinyurl.com/l52axwz
http://tinyurl.com/on9uybe
http://tinyurl.com/k84x46e
(You get the idea)

PS. Since some devices are 4:3, 16:10 and 16:9, I want to do 16:9 as most of my devices are in that format. Does anybody know a formula how to calculate the deviceheight/virtual resolution height, so that no matter what screen width I choose, I can always calculate the 16:9 aspect for the height to go with it? I know you get online calculators, and this is the best formula I've found for ease and simplity so far:
valueHeight = Math.round((value/16)*9)
Anybody else agree/have a better way?


Markus(Posted 2013) [#2]
i use this,
you have a 100x100 rect inside the screen,the rest is bonus.
u should allways use 1:1 aspect or the game will seen streched.

	Method OnRender:Int()

		Cls 0,0,0
		
		PushMatrix
		
	    Translate(Float(DeviceWidth()/2),Float(DeviceHeight()/2)) 'Middle

		'virtual resolution
		Local A:Float = Min(DeviceWidth(),DeviceHeight()) 'the smallest is 100%
	    Scale( A/100.0,A/100.0 ) 'scale it
	    
		DrawText("Hallo",0,0,0.5,0.5) 
		
		'cross
		SetColor(255,255,0)
		DrawLine(-50,-50,50, 50)
		DrawLine(-50, 50,50,-50)
		Rect(-50,-50,50,50)
		
		'grid
		For Local x:Int=-50 To 50 Step 10 
			DrawLine(x,-50,x,50)
		Next
		For Local y:Int=-50 To 50 Step 10 
			DrawLine(-50,y,50,y)
		Next
		
		For Local spr:Sprite=Eachin Sprites
		 spr.Render()
		Next
		
		Form1.Render()
		
		PopMatrix
		
		Return 1
		
	End		




Sensei(Posted 2013) [#3]
What does the push and pop matrix do anyway? I don't see any description in the docs..


DruggedBunny(Posted 2013) [#4]
@Jaco, take a look at the matrixrocks example in /bananas, which might (hopefully) help. (Read the comments!)


Sensei(Posted 2013) [#5]
Many thanks! I've been going through the examples, but since I'm taking a while to get through it all and kind of coding as I go, I've not reached that yet. Nice example with nice detailed info!


Markus(Posted 2013) [#6]
Push/Pop is a Stack for Translate/Rotate/Scale.
with push you memory the state and pop set the state from push again.


skape(Posted 2013) [#7]
Not sure I completely understood the issues you're having, but you are using the #MOJO_IMAGE_FILTERING_ENABLED="false" config, right?


Sensei(Posted 2013) [#8]
No idea what that is @unlikely. :-)
I'll look into it.


rIKmAN(Posted 2013) [#9]
Just add...
#MOJO_IMAGE_FILTERING_ENABLED = False
...to the top of your code.

See "App Config Settings" in the Monkey help.


Sensei(Posted 2013) [#10]
Thanks @rIKmAN. It makes more sense now. I'll have a play tonight. :)


Markus(Posted 2013) [#11]
i believe if you turn of the image filter it use
Nearest-neighbor_interpolation
http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation


Sensei(Posted 2013) [#12]
Very cool, thanks Markus!
Damn, why do I have to be at work instead of at home learning and coding Monkey :)


computercoder(Posted 2013) [#13]

why do I have to be at work instead of at home learning and coding Monkey :)


Amen.


rIKmAN(Posted 2013) [#14]
The trick is to make learning and coding in Monkey pay the bills.

Live the dream! :)


Sensei(Posted 2013) [#15]
Thanks rIKmAN. That preprocessor command did the trick :)

And yeah, I'm aiming towards full time game dev.. :)