"Integers won't look that smooth though." Worked fine on the Nintendo, Genesis, ST, Amiga, etc. ;)
I doubt mesh code will be something for general use. A mesh may work best for static, non dynamic maps. But if you want animated tiles, different alpha states, texture states, etc, etc, it may be quicker to just do what we're doing now. Plus I don't think a mesh will solve the artifacting either. If your top left destination pixel is a float then all tiles in the mesh will also be plotted at floating point values causing the artifact. I've experimented with both integer and float based map rendering, to be honest, I'm not seeing enough of a problem to worry about either method. In your (GA) map test, I've ran it on several computers and it looks fine.
The "artifacts" we talk about is simply the 3d card performing smoothing on the edges of the tile when rendering to floating point destinations.
In this example, I've faked a mesh render by placing tiles inside a 512x512 texture and then rendering this texure to the screen. In other words, the tiles are not individually rendered, the entire texture at once is rendered. Similar to how a mesh would render.
http://jgoware.com/mge/misc/tiletest.zip
In the demo you can press F to alternate between float/int based rendering. As you can see, with floating point rendering, you still get artifacting. While mesh rendering will indeed speed up certain game types, it will not solve the artifacting issue.
If you want pixel perfect tiles, sprites, etc, render to int coordinates. I would use this method in typical arcade platformers, etc. Other games like space shooters, etc, without tiled backgrounds may look better rendering to floats. ;)
I doubt mesh code will be something for general use. A mesh may work best for static, non dynamic maps. But if you want animated tiles, different alpha states, texture states, etc, etc, it may be quicker to just do what we're doing now. Plus I don't think a mesh will solve the artifacting either. If your top left destination pixel is a float then all tiles in the mesh will also be plotted at floating point values causing the artifact. I've experimented with both integer and float based map rendering, to be honest, I'm not seeing enough of a problem to worry about either method. In your (GA) map test, I've ran it on several computers and it looks fine.
The "artifacts" we talk about is simply the 3d card performing smoothing on the edges of the tile when rendering to floating point destinations.
In this example, I've faked a mesh render by placing tiles inside a 512x512 texture and then rendering this texure to the screen. In other words, the tiles are not individually rendered, the entire texture at once is rendered. Similar to how a mesh would render.
http://jgoware.com/mge/misc/tiletest.zip
In the demo you can press F to alternate between float/int based rendering. As you can see, with floating point rendering, you still get artifacting. While mesh rendering will indeed speed up certain game types, it will not solve the artifacting issue.
If you want pixel perfect tiles, sprites, etc, render to int coordinates. I would use this method in typical arcade platformers, etc. Other games like space shooters, etc, without tiled backgrounds may look better rendering to floats. ;)
SetGraphicsDriver D3D7Max2DDriver() 'SetGraphicsDriver GLMax2DDriver() Graphics(640,480,32) ' Global x:Float=0 Global fmode:Int=1 Global tiles:TImage = LoadImage("tiletest.png",FILTEREDIMAGE | MIPMAPPEDIMAGE) ' HideMouse() ' SetColor(255,255,255) SetTransform(0,1,1) SetAlpha(1) ' While Not KeyHit(KEY_ESCAPE) ' Cls() ' If KeyHit(KEY_F) ; fmode = Not fmode ' If fmode DrawText "(F)loating Point On",0,0 DrawImage(Tiles,x,50,0) Else DrawText "(F)loating Point Off",0,0 DrawImage(Tiles,Int(x),50,0) EndIf ' x=x+.15 If x>639 Then x = 0 Flip(1) ' Wend ' ShowMouse() EndGraphics()